Managing an MD Device

Removing and Adding an MD Mirror Component DiskRemoving and Adding an MD MirrorComponent Disk

There are certain failure scenarios, where you would need to manually remove the mirror component of an MD device and add it again later. For example, if links between two data centers fail, you would need to remove and add the disks that were marked as failed disks.

When a disk within an MD device fails, the /proc/mdstat file of the MD array displays a message. For example:

[root@dlhct1 dev]# cat /proc/mdstat Personalities : [raid1]

md0 : active raid1 sde[2](F) sdf[0] 9766784 blocks [2/1] [U_]

unused devices: <none>

In the message, the (F) indicates which disk has failed. In this example, the sde[2] disk has failed.

In such a scenario, you must remove the failed disk from the MD array. You need to determine the persistent name of the failed disk before you remove it from the MD array. For this example, run the following command to determine the persistent name of the disk:

# udevinfo -q symlink -n sdc1

Following is a sample output:

hpdev/mylink-sdc \ disk/by-id/scsi-3600805f3000b9510a6d7f8a6cdb70054-part1 \ disk/by -path/pci-0000:06:01.0-scsi-0:0:1:30-part1

Run the following command to remove a failed component device from the MD array:

#mdadm - -remove <md device name> <md_mirror_component_persistent_name>

In this example:

# mdadm --remove /dev/md0 /dev/hpdev/mylink-sdc1

This command removes the failed mirrored disk from the array.

Appendix A

101