Difference between revisions of "Mdadm"

From Useful Things
Jump to: navigation, search
(Created page with "== Remove a drive from an active array == <pre> mdadm --manage /dev/md0 --fail /dev/sdX # set the drive as failed mdadm --manage /dev/md0 --remove /dev/sdX # remove the drive...")
 
 
Line 12: Line 12:
 
== Check array status ==
 
== Check array status ==
 
Both <code>cat /proc/mdstat</code> and <code>mdadm --detail /dev/md0</code> have detailed output about configured arrays.
 
Both <code>cat /proc/mdstat</code> and <code>mdadm --detail /dev/md0</code> have detailed output about configured arrays.
 +
 +
== Possible issues ==
 +
=== Array refuses to rebuild when in a degraded state and a new drive is added ===
 +
The array might be frozen:
 +
<pre>
 +
root@galaxy:~# cat /sys/block/md0/md/sync_action
 +
frozen
 +
</pre>
 +
So give it a nudge:
 +
<pre>
 +
root@galaxy:~# echo idle > /sys/block/md0/md/sync_action
 +
root@galaxy:~# cat /sys/block/md0/md/sync_action
 +
recover
 +
</pre>

Latest revision as of 12:47, 22 March 2015

Remove a drive from an active array

mdadm --manage /dev/md0 --fail /dev/sdX # set the drive as failed
mdadm --manage /dev/md0 --remove /dev/sdX # remove the drive from the array

Add a drive to an active and degraded array

mdadm --manage /dev/md0 --add /dev/sdX # add the drive

Check array status

Both cat /proc/mdstat and mdadm --detail /dev/md0 have detailed output about configured arrays.

Possible issues

Array refuses to rebuild when in a degraded state and a new drive is added

The array might be frozen:

root@galaxy:~# cat /sys/block/md0/md/sync_action
frozen

So give it a nudge:

root@galaxy:~# echo idle > /sys/block/md0/md/sync_action
root@galaxy:~# cat /sys/block/md0/md/sync_action
recover