September 2010
All copy-pasted from the RAID Wiki:
In /etc/mdadm/mdadm.conf
:
DEVICE partitions # auto-create devices with Debian standard permissions CREATE owner=root group=disk mode=0660 auto=yes # automatically tag new arrays as belonging to the local system HOMEHOST <system> # instruct the monitoring daemon where to send mail alerts MAILADDR user@mydomain.org ARRAY /dev/md0 level=raid1 num-devices=2 devices=/dev/sdb1,/dev/sdc1 spares=/dev/sdd1 UUID=6b0638f4:5e0d924c:84cc9bd1:d1563c47
Then to create the raid:
user@host:~$ sudo mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb1 /dev/sdc1 --spare-devices=1 /dev/sdd1
... and to put it together (I needed to script /etc/init.d/raid
that does this at every boot):
user@host:~$ sudo mdadm --assemble /dev/md0
... to test the raid:
user@host:~$ sudo mdadm --manage --set-faulty /dev/md0 /dev/sdc1
(That should get you some mail!) Then to see what the daemon is doing:
user@host:~$ sudo mdadm --detail /dev/md0
user@host:~$ /proc/mdstat
... and to put the RAID back together the way it is supposed to be configured:
user@host:~$ sudo mdadm /dev/md0 -r /dev/sdc1
user@host:~$ sudo mdadm /dev/md0 -a /dev/sdc1