Raid Software (MDx)
Note: If you've problem like ERROR: sector 0. You could use --force option.
Global overview (info)
cat /proc/mdstat
Detailed information
mdadm --misc --detail /dev/mdx
Create a new raid (drives and/or partitions)
mdadm --create /dev/mdx --level=1 --raid-devices=2 /dev/sdaX /dev/sdbX
Add a drive to an existing raid
mdadm /dev/mdx --manage --add /dev/sdbx
Declare an array as failed
mdadm --fail /dev/mdx /dev/sdax
Copy partitions (identical partitions)
Especially useful if you've changed a drive (e.g. broken), or if you badly manipulate a disk. Let say it happens on /dev/sda
:
# if MBR
sfdisk -d /dev/sdb | sfdisk /dev/sda
# elif GPT (-R for replicate)
sgdisk -R=/dev/sda /dev/sdb
Remove raid partitions
umount -l /dev/mdX
mdadm --stop /dev/mdX
mdadm --zero-superblock /dev/sdaX
mdadm --zero-superblock /dev/sdbX ... etc.
Resync is pending
Might happened if you reboot during a sync, the following command will continue the sync:
mdadm --readwrite /dev/mdx