Linux: Move / to Software RAID 1

It’s a simple thought: build a software RAID 1 disk array with an empty hard disk, and copy data on / to it. After data copied, add the old disk to the array.

For example,

(sda is the old /, and sdb is the new disk)
# sfdisk -d /dev/sda | sfdisk /dev/sdb
# mdadm -C /dev/md0 –level=raid1 –raid-devices=2 /dev/sdb1 missing
# mkfs -t ext3 /dev/md0
# mount /dev/md0 /mnt
# rsync -ax / /mnt/
# vim /etc/fstab
# vim /boot/grub/menu.lst

Modify fstab and menu.lst, and make sure all /dev/sda is changed to /dev/md0.

# reboot

Make sure that md0 is mounted successfully.

# mdadm –manage /dev/md0 –add /dev/sda1

Now, we successfully moved / to software RAID 1 :)

1 Response to “Linux: Move / to Software RAID 1”

Leave a Reply