mdadm
mdadm command, which is used for managing software RAID (Redundant Array of Independent Disks) configurations in Linux. Here’s an overview of its usage and functionality:
mdadm Command
mdadm CommandPurpose:
RAID Management:
mdadmis used to create, manage, and monitor software RAID arrays in Linux.Device Administration: It allows for various operations such as assembling, reassembling, and managing RAID devices and arrays.
Basic Usage:
Create RAID Array:
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1Creates a RAID 1 (mirror) array named
/dev/md0using/dev/sdb1and/dev/sdc1.
Assemble RAID Array:
mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1Assembles the RAID array
/dev/md0using specified devices.
Manage Arrays:
--detail: Display detailed information about RAID arrays.--monitor: Monitor RAID arrays for changes and events.--stop: Stop (deactivate) a running RAID array.--failand--remove: Mark a device as failed and remove it from the array.
Configuration:
--detail --scan: Outputs configuration details suitable formdadm.conf.--examine: Examine RAID metadata on devices.
Monitoring and Maintenance:
Monitoring: Use
mdadm --monitorto monitor arrays for failures or changes.Maintenance: Replace failed disks with
--manage --replace.
Examples:
Create RAID 5 Array:
mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1Creates a RAID 5 array named
/dev/md0with three devices.
Assemble All Arrays:
mdadm --assemble --scanAssembles all RAID arrays listed in
mdadm.conf.
Additional Options:
-v, --verbose: Provides detailed output.-Q, --brief: Provides brief output suitable for scripting.-h, --help: Displays help information.
Conclusion
mdadm is a powerful command-line tool for managing software RAID arrays on Linux systems. It offers flexibility in creating different RAID levels (0, 1, 5, 10, etc.), monitoring array health, and handling device failures. Always refer to the mdadm documentation (man mdadm) for comprehensive details and advanced usage scenarios. This ensures efficient management and maintenance of RAID configurations to enhance data reliability and availability.
Last updated