Burocrati, Amministratori, wegan
111
contributi
(Partial content, just not to loose everything) |
(Again, saving, not complete) |
||
Riga 14: | Riga 14: | ||
* Create a RAID1 array composed by 2 drives but with a drive marked as missing | * Create a RAID1 array composed by 2 drives but with a drive marked as missing | ||
* Set LVM up on top of it (as the old drive had LVM (it's a 120GB drive just for the `/` parition, we wanted to have some space available if we'll ever find in the need) | * Set LVM up on top of it (as the old drive had LVM (it's a 120GB drive just for the `/` parition, we wanted to have some space available if we'll ever find in the need) | ||
* | * Boot a live distro and copy / | ||
* Install the bootloader on the new drive adding the necessary modules for RAID and LVM | ** Install the bootloader on the new drive adding the necessary modules for RAID and LVM | ||
* Reboot the server from the RAID-memeber disk | * Reboot the server from the RAID-memeber disk | ||
* Check if everything is OK | * Check if everything is OK | ||
Riga 63: | Riga 63: | ||
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sde1 missing | mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sde1 missing | ||
mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sde5 missing | mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sde5 missing | ||
We made the filesystem on the newly created /dev/md1 | |||
mkfs.ext2 /dev/md1 | |||
And copied the files | |||
mount /dev/md1 /mnt | |||
rsync -avPh /boot /mnt | |||
sync && umount /mnt | |||
We were done with /boot, ans we needed to create the LVM volumes: | |||
First we marked /dev/md2 as LVM member then we told LVM /dev/md2 was a device it could use | |||
pvcreate /dev/md2 | |||
We then created the virtual group that was going to host the logical volumes | |||
vgcreate ba-system /dev/md2 | |||
And created the logical volumes over it | |||
lvcreate -L30G -n root ba-system | |||
lvcreate -L4G -n swap ba-system | |||
We createed the filesystem for root | |||
mkfs.ext4 /dev/mapper/ba--system-root | |||
And for swap | |||
mkswap /dev/mapper/ba--system-swap | |||
Then it was time to poweroff the server and boot from a live, we choosed ArchLinux as it's lightweight and provides all the packages we need without forcefully bringing up an installation procedure | |||
We mounted the root partitions | |||
mkdir /mnt/old /mnt/new | |||
mount /dev/mapper/ba--system-root /mnt/new | |||
mount /dev/mapper/bitarno--system-root /mnt/old | |||
And copied the datas over: | |||
rsync -avPh /mnt/old/ /mnt/new | |||
We then proceeded to mount the boot partition | |||
mount /dev/md1 /mnt/new/boot | |||
And arch-chroot'ed into it arch-chroot is a wonderfull piece of software that saves you from bind mounting /dev /proc and /sys in the chroot | |||
arch-chroot /mnt/new | |||
It was time to install grub and regenerate the image to contain LVM and RAID modules, this was the hardest part as we wrongly supposed all the modules were already present. | |||