To add a partition
to a RAID device, execute the following
as root after creating the partition of type Linux raid auto (fd in fdisk):
mdadm /dev/mdX -a <device list>
To add /dev/sda8 to the /dev/md0 RAID device created in the previous
section:
mdadm /dev/md0 -a /dev/sda8
shows the output from cat /proc/mdstat. The /dev/sda8 partition is now a spare partition
in the RAID array.
Adding a Spare Partition
Personalities : [raid0]
[raid1]
md0 : active raid1 sda8[3](S)
sda7[2] sda6[1] sda5[0]
10241280 blocks [3/3] [UUU]
[>....................] resync = 0.6% (66560/10241280) finish=84.0min
speed=2016K/sec
unused devices:
<none>
If a partition in the array fails, use the following to remove it from the array and rebuild
the array using the spare partition already added:
mdadm /dev/mdX
-f <failed device>
For example,
to fail /dev/sda5 from /dev/md0 and replace
it with the spare (assuming
the
spare has already been added):
mdadm /dev/md0
-f /dev/sda5
To verify that the device has been failed and that the rebuild
has been complete and was successful, monitor the /proc/mdstat file.
tail -f /proc/mdstat
Notice that /dev/sda5 is now failed and that /dev/sda8 has changed
from a spare to an active partition
in the RAID array.
Failing a Partition and Replacing with a Spare
Personalities : [raid0] [raid1]
md0 : active raid1
sda8[3] sda7[2] sda6[1]
sda5[4](F)
10241280 blocks [3/2] [_UU]
[>....................] recovery = 0.2% (30528/10241280) finish=11.1min
speed=15264K/sec
unused devices:
<none>
0 comments:
Post a Comment