Fast way to create or assemble mdadm devices


Booting from cd and no /dev/md devices?

First, correct kernel modules are needed.
modprobe raid1
If configuration uses different raid, then a different raid module should be loaded. Be it a raid 0,5,6 or whatever.

Devices can be made then
mknod /dev/md0 b 9 0
mknod /dev/md1 b 9 1

and so on. As many of them as needed.
From this point on door is open for mdadm create,assemble or whatever is needed.

Creating a device goes like this:
mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda2 /dev/sdc2

If creating a raid 1 (mirror) device to boot from, at least for now, level 0.90 metadata should be used. like so:
mdadm --create --verbose /dev/md0 --metadata=0.90 --level=1 --raid-devices=2 /dev/sda2 /dev/sdc2

When all that is needed to get some already existing devices to work, assemble is the keyword.
Assembling like this
mdadm --assemble --verbose /dev/md0 /dev/sda2 /dev/sdc2

And finally adding disk back to array after replacing faulty drive
mdadm --add --verbose /dev/md2 /dev/sda4

Finally, watching progress on create can be done like this:
watch -n1 'cat /proc/mdstat'

Leave a comment

Your email address will not be published. Required fields are marked *