[CentOS] converting system to raid1

Wed May 23 17:07:59 UTC 2007
Daniel de Kok <danieldk at pobox.com>

On Wed, 2007-05-23 at 12:03 -0400, Dave wrote:
>     I've got a single-drive CentOS5 system with two partitions on it, a 101 
> mb boot, and the rest of the disk as an lvm volume, two partitions in it, / 
> and swap. I've got another disk, same size, and i'd like to add it in as a 
> primary slave drive and convert this system to raid1 for redundancy. I do 
> not want to reinstall this box, which is what the docs i've read say it's 
> easiest to do. Some elude to a procedure, hard yes, time consuming with 
> copying probably, that can do it. Has anyone done this?

Yes. Roughly, one of the possible procedures is:

- Make backups(!).
- Add the new disk, and make two Linux RAID partitions (one for 
  the /boot partition, and one to hold a LVM PV).
- Make two RAID-1 sets both with one partition.
- Make a filesystem on the smallest RAID set, and copy the files 
  from /boot there.
- Make the second RAID set a LVM PV.
- Add this LVM PV to the VolumeGroup that holds / and swap.
- Use pvmove to set up to move the physical extends from the 'old'
  disk to the PV on RAID.
- Install GRUB on the new disk.
- Double-check /etc/fstab and /boot/grub/menu.lst (should be ok,
  since the volgroup and volume names have not changed).
- Remove the PV from the old disk from the VG.
- Remount /boot from the new disk.
- Create RAID partitions on the old disk to match the RAID setup from
  the new one.
- Add both RAID partitions to the set, and let it reconstruct the set.
- Reinstall GRUB to the old disk.

Make sure that the partitions on the new disk are not larger than the
partitions on the old disk. And don't do it, unless you know what you
are doing. If something fails, you'll have to be able to deal with it.

-- Daniel