mdadm --query /dev/name-of-device
This will find out if a given device is a RAID array, or is part
of one, and will provide brief information about the device.
mdadm --assemble --scan
This will assemble and start all arrays listed in the standard
config file. This command will typically go in a system startup
file.
mdadm --stop --scan
This will shut down all arrays that can be shut down (i.e. are
not currently in use). This will typically go in a system
shutdown script.
mdadm --follow --scan --delay=120
If (and only if) there is an Email address or program given in
the standard config file, then monitor the status of all arrays
listed in that file by polling them ever 2 minutes.
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd[ac]1
Create /dev/md0 as a RAID1 array consisting of /dev/hda1 and
/dev/hdc1.
echo 'DEVICE /dev/hd*[0-9] /dev/sd*[0-9]' > mdadm.conf
mdadm --detail --scan >> mdadm.conf
This will create a prototype config file that describes currently
active arrays that are known to be made from partitions of IDE or
SCSI drives. This file should be reviewed before being used as
it may contain unwanted detail.
echo 'DEVICE /dev/hd[a-z] /dev/sd*[a-z]' > mdadm.conf
mdadm --examine --scan --config=mdadm.conf >> mdadm.conf
This will find arrays which could be assembled from existing IDE
and SCSI whole drives (not partitions), and store the information
in the format of a config file. This file is very likely to
contain unwanted detail, particularly the devices=
entries. It
should be reviewed and edited before being used as an actual
config file.
mdadm --examine --brief --scan --config=partitions
mdadm -Ebsc partitions
Create a list of devices by reading /proc/partitions
, scan these
for RAID superblocks, and printout a brief listing of all that
were found.
mdadm -Ac partitions -m 0 /dev/md0
Scan all partitions and devices listed in /proc/partitions
and
assemble /dev/md0
out of all such devices with a RAID superblock
with a minor number of 0.
mdadm --monitor --scan --daemonise > /run/mdadm/mon.pid
If config file contains a mail address or alert program, run
mdadm in the background in monitor mode monitoring all md
devices. Also write pid of mdadm daemon to /run/mdadm/mon.pid
.
mdadm -Iq /dev/somedevice
Try to incorporate newly discovered device into some array as
appropriate.
mdadm --incremental --rebuild-map --run --scan
Rebuild the array map from any current arrays, and then start any
that can be started.
mdadm /dev/md4 --fail detached --remove detached
Any devices which are components of /dev/md4 will be marked as
faulty and then remove from the array.
mdadm --grow /dev/md4 --level=6 --backup-file=/root/backup-md4
The array /dev/md4
which is currently a RAID5 array will be
converted to RAID6. There should normally already be a spare
drive attached to the array as a RAID6 needs one more drive than
a matching RAID5.
mdadm --create /dev/md/ddf --metadata=ddf --raid-disks 6
/dev/sd[a-f]
Create a DDF array over 6 devices.
mdadm --create /dev/md/home -n3 -l5 -z 30000000 /dev/md/ddf
Create a RAID5 array over any 3 devices in the given DDF set.
Use only 30 gigabytes of each device.
mdadm -A /dev/md/ddf1 /dev/sd[a-f]
Assemble a pre-exist ddf array.
mdadm -I /dev/md/ddf1
Assemble all arrays contained in the ddf array, assigning names
as appropriate.
mdadm --create --help
Provide help about the Create mode.
mdadm --config --help
Provide help about the format of the config file.
mdadm --help
Provide general help.