Converting to Software RAID

The process for converting an existing system to utilize software RAID is simple and requires just a few steps:

  1. Build a new kernel with software RAID support. Refer to Chapter 3 for details on how to include RAID support in the kernel. Be certain to include support for RAID-1, as well as generic RAID support. Remember, only RAID-1 works for boot partitions. In this tutorial, I’ll assume that you are using RAID-1 for all system partitions, that your existing system partitions are on /dev/sda, and that the new disk is /dev/sdb.

  2. After you reboot the system using your new kernel, create partitions on your new disk for each of the partitions (including swap space) on your existing system disk. So if you have three partitions on your existing disk (/, /boot, and swap) create three matching partitions on the new disk. If you want to alter the size of any system partition, do so at this point by creating the new partitions using different specifications. Don’t forget to mark each new partition Linux RAID Auto (that’s type 0xFD).

  3. After creating partitions on the new disk (/dev/sdb), create a new RAID-1 for each partition. Include a partition from /dev/sdb in each array. If you use mkraid, you will need to create each array so that it has a failed-disk entry. The failed-disk entry corresponds to the existing partition on /dev/sda. The raid-disk entry for each array will be the new partition on /dev/sdb. I prefer to use mdadm for this process.

    # mdadm -C -n2 -l1 /dev/md0 ...

Get Managing RAID on Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.