I'd like to setup RAID 1 with two drives in linux. I don't have a hardware RAID controller and don't want to buy one, so what is the best software RAID option for linux?

Note: If it makes a difference, I'm running Gentoo.

  • since you'll be using mdadm you might want to consider using raid10,f2 which can work on 2 drives and should offer a read performance benefit. Commented Aug 12, 2010 at 22:13

3 Answers 3


Use mdadm, check the manpage. However, I will list one gotcha here. If you do this and really want reliability, you should make sure your master boot record is copied to both drives. By default it will likely only get copied to one drive. If that drive dies, you cannot boot from the other drive, even though all your data is safe.

To copy the mbr to both drives, use something like dd to copy the first 446 bytes of one drive to the other.

dd if=/dev/sda of=/dev/sdb bs=446 count=1

If you're building the RAID on top of the devices (/dev/sda) rather than on top of partions on the devices (/dev/sda1), then you probably shouldn't do what I am suggesting because you're writing data directly to the device underneath the md driver. At least, I've never tried it that way.

  • How do you ensure that the MBR is copied to both drives? do you have a link to instructions?
    – Kris
    Commented Aug 10, 2010 at 21:02
  • 1
    You might want to fix the 'md' typo in your snippet there. Also, any specific reason you mention the first 446 bytes, whereas I think to remember an mbr being 512 bytes?
    – wzzrd
    Commented Aug 12, 2010 at 20:46
  • @wzzrd: fixed, thanks. While the whole 512 is properly called the MBR, the first 446 bytes contain everything BUT the partition table. Copying the partition table is sometimes not what people want You could make a RAID1 out of partions on different devices that aren't the same drive and would have different partition info.
    – kbyrd
    Commented Aug 12, 2010 at 23:10

You can use mdadm to manage software raid on linux.


livecd ~ $ mdadm --create /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda1 /dev/sdb1

mdadm: array /dev/md1 started.
  • 4
    This doesn't add anything useful to the existing answers. Or maybe it does - why do you force a specific metadata version?
    – Mat
    Commented Feb 1, 2012 at 10:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .