Skip to main content

mdadm - Software Raid

Summary of commands dealing with software raid at linux machines

 

Create an array

mdadm --create /dev/md/md_name --level=<RAID-Level> --raid-devices=<amount of physical partitions at array> /dev/sdX1 /dev/sdY1

Check raid array

mdadm --detail /dev/md/<LABEL>

# or

cat /proc/mdstat

Remove raid array

umount /dev/md/md_name
mdadm --stop /dev/md/md_name
mdadm --zero-superblock /dev/sdX1
mdadm --zero-superblock /dev/sdY1

Restart sync of array

mdadm --readwrite /dev/md/md_name

Update raid config

/usr/share/mdadm/mkconfig > /etc/mdadm/mdamd.conf

When device is needed for boot

update-initramfs -u
update-grub2
grub-install /dev/sdX