see this and
this and
this
with a
nice summary here
To see the status of any RAID setups:
cat /proc/mdstat
To create a linear array (spanning 2 or more partitions)
- create 2 partitions (say
/dev/sdb1 and /dev/sdb2)
- create the array:
mdadm --create --verbose /dev/md0 --level=linear --raid-devices=2 /dev/sdb1 /dev/sdb2
- create a filesystem:
mkfs /dev/md0
- mount it!:
mnt /dev/md0 /mnt/raid
RAID1
- To create a RAID1 (mirrored) with 1 backup drive:
mdadm --create --verbose /dev/md0 --level=raid1 --raid-devices=2 -x 1 /dev/sdb1 /dev/sdb2 /dev/sdb3
What to do when an array drive dies (with a safe, SCA-based system. Like one with a
SuperMicro SCA814S backplane)
- pull out the bad drive
- tell the raid to remove it
mdadm /dev/md0 --remove /dev/sdc1
- replace the drive
- tell the raid to remove it
mdadm /dev/md0 --add /dev/sdc1
- let it rebuild!
Misc
- Show details about an array:
mdadm --detail /dev/md0
- 'Stop' an array (tell kernel to release it):
mdadm -S /dev/md0
- Dump status of arrays on the system:
mdadm --detail --scan (can be copied directly into /etc/mdadm.conf)
- Dump status on for a given array:
mdadm /dev/md0
- Dump status about one disk and the array it belongs to:
mdadm --examine /dev/sdb1
- Assemble previously set up RAID partitions into a RAID volume:
mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdb2
- Add a spare disk
mdadm /dev/md0 --add /dev/sdb3
- Remove a spare disk
mdadm /dev/md0 --remove /dev/sdb3
- Simulate a drive going faulty:
mdadm --manage --set-faulty /dev/md0 /dev/sdb2
--
MattWalsh - 15 Dec 2006