preload
Dec 27

So lets create array. I’ll use mdadm on this example. I assume that we will have two SATA drives and they have been allready partitioned. Make the partition types Linux raid autodetect which is fd in fdisk. Also remember to make bootable flags with option a.

We will do two raid-devices, swap and root.

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2

If you get error that device md0 or 1 doesnt exist just create them.

mknod /dev/md0 b 9 0
mknod /dev/md1 b 9 1

You can also make array with single disk to degraded mode if you are doing system rescue or adding raid to a existing system.

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 missing

Now you have array running. Make filesystem to it and mount it for use.

 
mkfs.ext3 /dev/md1 
mount /dev/md1 /to/some/mountpoint

And you are done.

Thanks for Dan who made correction to syntax for creating array. There should be dashes in raid-devices directive. I corrected the instruction.

Leave a Reply

You must be logged in to post a comment.