Wumple.com

2007/01/24

Dynamically adding a device to a Linux software RAID 1 array

Filed under: — Stormwind @ 3:11 am

I recently switched wumple.com’s boot partition to a RAID 1 array so I will be able to boot up even if the disk that had the original /boot partition failed. I generally followed the directions (with modifications for my setup and Fedora, and skipping unneeded parts) from the HOWTO Install on Software RAID (Gentoo).

At the end, I needed to grow my RAID 1 array from 2 devices to 3 so I could add the original /boot partition to the array. 

It was much easier than I expected.  Here is what I did:

  1. Set up the partitions on the new disk as usual for RAID (including partition type fd, "Linux raid autodetect"
  2. Expand the number of active devices in the array (md1 from 2 to 3 drives in my case): "/sbin/mdadm /dev/md1 –grow -n 3"
  3. Add the new device (in my case /dev/sdc1) to the array: "/sbin/mdadm /dev/md1 –add /dev/sdc1"
  4. Watch the array rebuild onto the new device: "watch -n 1 cat /proc/mdstat"
  5. Followed the steps in the HOWTO to put grub back on the device

For some reason, in /etc/fstab I had to change /boot from "LABEL=/boot" to "/dev/md1" in /etc/fstab so the system could mount /boot during startup (and I know I gave the filesystem the label of /boot on creation).  Otherwise the failure to mount /boot when all local filesystems are mounted would stop the boot process.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

|| RSS 2.0 || Comments RSS 2.0 || XHTML || Powered by WordPress ||