mdadm / software raid¶
create raid¶
raid 1:
if you get an error like mdadm: invalid number of raid devices: devices=2 run the command like so (with -l
for level and -n
for devices):
create a file system:
or whatever filesystem you want.
check raid status¶
check also: /proc/mdstat
save raid config¶
well, that's somewhat important, right?
Run update-initramfs -u
after updating this file.
also, back up the mdadm.conf
file to restore it onto a new system
add and remove devices to/from raid¶
if they're in a faulty state for example
replace disk¶
check how to backup and copy your partition table
remove disk:
copy partition table from backup or primary drive:
add disk:
convert single disk to raid 1¶
... hopefully without losing data!
- create raid from 2nd disk with one missing disk
- copy data from 1st disk to 2nd disk (now in raid)
- add 1st (original) disk to raid config
- rebuild raid
- profit (took 5 steps, I'm sorry)
create raid:
notice the missing
bit?
now copy the data from the original disk to the newly created raid, so create and mount your filesystem on /dev/md0
[...]
prepare original disk:
let's dump (-d
the disk layout from the raid disk to the original disk):
add original disk to raid:
check raid rebuild status:
...in minutes
increase mdadm rebuild / resync speed¶
you can check the current speed limits with:
and, now just increase that number to make it faster (it's displayed in kb)
debugging things¶
if you messed things up, you can try and restore things with testdisk