Debian RAID boot

Create a RAID1 array using only a single active disk
# mdadm –create /dev/md0 –level 1 –raid-devices=2 missing /dev/hda1
# mkfs.ext3 /dev/md0
Where hda1 is a new partition destined to become a second boot partition.

Copy the /boot content to the new volume
# mkdir /root/boot
# mount /dev/md0 /root/boot
# cp -rp /boot/* /root/boot

Make a partition bootable
#grub –device-map=/boot/grub/device.map

>> root (hd0,0)
>> setup (hd0)
>> quit

Where (hd0,0) is disk0,partition0. (hd1,0) would be disk1,partition0.
Note: I find it useful to keep in mind that systems do not boot from an RAID array. They boot from disks that can be members of a RAID array. The mirroring only comes into effect once the system has booted, until then they are two bootable partitions with no knowledge of each other.

Add an additional disk to an already existing RAID1 array
# mdadm /dev/md0 –add /dev/hdb1
Where hdb1 is the old boot partition being replaced by md0. The command will overwrite the content of hdb1 with the existing md0 content.

1 comment

  1. The grub installation component of this has been superseded now and can be accomplished just by running grub-install [DEVICE].
    Eg. grub-install /dev/sda

Leave a comment