Reminder : Mdadm commands

I'll try to sum up here everyday needed commands with mdadm.

Of course, you'll need to replace partitions letters and numbers by yours.
Every line is a different command and require root privileges.

  • Install raid manager (mdadm) on Debian based distros (Ubuntu, Linux Mint...)
 apt-get install mdadm

  • Create a new raid with all disks presents
 mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

  • Create a new raid with only one present (use it to migrate a single drive to a raid : first create the raid with one disk, copy data, complete the raid with the second disk)
 mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sda1
 
  • Get a quick overview of raids running on the system
  cat /proc/mdstat

  •  Get full details of a raid
  mdadm --detail /dev/md0

  • Assemble an existing raid with all disks presents
 mknod /dev/md0 b 9 0
 mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1

  • Assemble a 2-disks raid with only one present (use it if one disk crashed)
 mknod /dev/md0 b 9 0
 mdadm --assemble /dev/md0 /dev/sda1 --force

  • Add a new partition to an existing raid 
 mdadm --manage /dev/md0 --add /dev/sdb1


Commentaires

Posts les plus consultés de ce blog

Calendrier google des jours fériés

Easily create your own Eclipse

Eclipse.ini file