mdadm
Manage Linux software RAID arrays
TLDR
Create array
Stop array
Mark disk as failed
Remove disk
Add disk to array
Show RAID info
Reset disk by deleting RAID metadata
SYNOPSIS
mdadm [options]
PARAMETERS
--assemble
Assemble a previously created array. Can also be used to start a stopped array.
--create
Create a new RAID array.
--manage
Modify or manage an existing array.
--detail
Show detailed information about a RAID device.
--stop
Deactivate a RAID array.
--add
Add a spare disk to an array.
--remove
Remove a disk from an array.
--fail
Mark a device as failed.
--zero-superblock
Remove RAID metadata from a device.
--level=level
Specify the RAID level to use when creating an array (e.g., raid0, raid1, raid5, raid6, raid10).
--raid-devices=number
Specify the number of active devices in the array.
--bitmap=internal
Use the internal bitmap RAID feature.
--force
Force an operation that would otherwise be refused.
DESCRIPTION
The mdadm command is a utility used in Linux to manage software RAID (Redundant Array of Independent Disks) arrays. It allows you to create, manage, monitor, and troubleshoot RAID devices. Software RAID uses the Linux kernel's capabilities to provide data redundancy and performance improvements by combining multiple physical disks into a single logical volume. With mdadm, you can configure various RAID levels (RAID0, RAID1, RAID5, RAID6, RAID10, etc.), assemble existing arrays, monitor their health, add or remove drives, and perform recovery operations in case of disk failures. The command provides functionalities for creating a new RAID array, defining the desired RAID level, specifying the member disks, and starting the array. mdadm also allows you to query the status of RAID arrays, examine their configuration, and detect any issues, such as failed drives or inconsistencies. The utility can send notifications about events related to RAID arrays, such as drive failures or rebuild completion. mdadm is a powerful tool for managing software RAID in Linux and crucial for maintaining data integrity and availability on systems that rely on RAID technology.
CAVEATS
Improper use can lead to data loss. Requires careful planning and understanding of RAID concepts. Permissions and device paths are critical.
It relies on the Linux kernel's RAID implementation; kernel support is essential.
CONFIGURATION FILE
mdadm uses a configuration file (typically /etc/mdadm/mdadm.conf) to store information about RAID arrays,
allowing arrays to be automatically assembled at boot time. Ensure this file is correctly configured for persistent RAID setup.
MONITORING
Regular monitoring of RAID arrays is crucial. mdadm can be configured to send email alerts upon drive failures or other critical events. Scripts can be integrated for more advanced monitoring.
RECOVERY
In case of a drive failure, mdadm provides tools to rebuild the array onto a replacement drive. Ensure you have a suitable replacement drive available and understand the rebuild process before a failure occurs.
HISTORY
mdadm (Multiple Device Administration) was developed to provide a standardized way to manage software RAID arrays across different Linux distributions.
Its development began in the early 2000s, aiming to offer a more robust and feature-rich alternative to earlier RAID management tools.
Over time, it has become the standard tool for managing software RAID in Linux, with ongoing development to improve its capabilities and support new RAID levels and features.