Increase Performance, Reliability and Capacity with Software RAID

Linux software RAID provides a flexible software alternative to hardware RAID with excellent performance.


  • Replace /dev/sda1 with /dev/md0.

  • Replace /dev/sda2 with /dev/md1.

Make sure GRUB is installed properly on both disks, and reboot the server:

# grub
> device (hd0) /dev/sda
> root (hd0,0)
> setup (hd0)
> device (hd0) /dev/sdb
> root (hd0,0)
> setup (hd0)
> quit

# reboot

When your server comes back on-line, it will be running on a RAID 1 array with only one drive in the array. To complete the process, you need to repartition the first drive, add it to the array, and make a few changes to GRUB. Make sure your server is functioning normally and all your data is intact before proceeding. If not, you run the risk of losing data when you repartition your disk or rebuild the array.

Use sfdisk to repartition the first drive to match the second drive. The --no-reread option is needed; otherwise, sfdisk will complain about not being able to reload the partition table and fail to run:

# sfdisk -d /dev/sdb | sfdisk /dev/sda --no-reread

Now that your first drive has the correct partition types, add it to both arrays. The arrays will start the rebuild process automatically, which you can monitor with /proc/mdstat:

# mdadm /dev/md0 -a /dev/sda1
# mdadm /dev/md1 -a /dev/sda2
# watch cat /proc/mdstat

Once the arrays have completed rebuilding, you safely can reconfigure GRUB to boot from the first drive. Although it is not required, you can reboot to make sure your server still will boot from the first drive:

# vim /boot/grub/menu.lst

Next, copy first kernel entry and change (hd1,0) to (hd0,0). Then:

# reboot

That completes the process. Your server should be running on a RAID 1 array protecting your data from a drive failure.


As you can see, Linux software RAID is very flexible and easy to use. It can protect your data, increase server performance and provide additional capacity for storing data. Software RAID is a high-performance, low-cost alternative to hardware RAID and is a viable option for both desktops and servers.