Azimout's Linux weblog


leave a comment »

To create a Raid1 (mirror) array in Linux, install mdadm and then run

sudo mdadm -C /dev/md0 -l 1 -n 2 /dev/sda /dev/sdb
sudo mkfs -t ext4 /dev/md0
sudo e2label /dev/md0 aziraid

Then modify your /etc/fstab accordingly

However, adding disks to the array by drive letter (e.g. /dev/sda) can be problematic if -as in my case- that drive letter changes. In my case, after a reboot the drives necessary for the array were no longer sda and sdb, but sdc and sdd, so the array wouldn’t start. mdadm cannot use UUIDs. A workaround is to use /dev/disk/by-id symlinks:

sudo mdadm /dev/md0 -A /dev/disk/by-id/ata-ST3750330AS_9QK1DZKN /dev/disk/by-id/ata-WDC_WD7500AADS-00M2B0_WD-WCAV5D812432

(idea borrowed from

To get information about the status of your RAID, use the following two commands:

cat /proc/mdstat
sudo mdadm --query --detail /dev/md*



Written by azimout

12/08/2010 at 16:25

Posted in Howto

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: