RAID management
RAID (Redundant Array of Independent Disks)- is a data storage virtualization technology that combines multiple physical disk drive components into one or more logical units for the purposes of data redundancy, performance improvement, or both.
Tip
mdadm is a tool for managing Linux software RAID devices (eg. RAID 0, RAID 1, RAID 5, etc.)
Commands:
mdadm --manage /dev/md0 --add /dev/sdX- add a new disk to RAIDmdadm --manage /dev/md0 --fail /dev/sdX- mark a disk as faultymdadm --manage /dev/md0 --remove /dev/sdX- remove a disk from RAIDmdadm --detail /dev/md0andcat /proc/mdstat- display RAID status and show information about RAIDmdadm --stop /dev/md0- stop RAIDmdadm --run /dev/md0- start RAIDmdadm --assemble --run /dev/md0 /dev/sdX /dev/sdY /dev/sdZ /dev/sdW- assemble RAID from disks and start itmount /dev/md0 /srv/...- mount RAIDfdisk -l- list disks and partitionslsblk- list block devicesblkid- locate/print block device attributes
How to replace a faulty disk in RAID with a new one:
Identify a faulty disk:
mdadm --detail /dev/md0orcat /proc/mdstatMark a disk as faulty:
mdadm --manage /dev/md0 --fail /dev/sdXRemove a disk from RAID:
mdadm --manage /dev/md0 --remove /dev/sdXTurn off RAID:
mdadm --stop /dev/md0Physically replace a faulty disk with a new one
Add the new disk to the RAID array:
mdadm --manage /dev/md0 --add /dev/sdYStart RAID:
mdadm --run /dev/md0Verify RAID status:
mdadm --detail /dev/md0orcat /proc/mdstat