Remove Multipath Block Device

From Linux User Group at WUR
Jump to: navigation, search

Removing path/device

Let's take an example where the paths have already been closed from the SAN, and see see this from using multipath:

# multipath -ll

sdb: checker msg is "tur checker reports path is down"
sdd: checker msg is "tur checker reports path is down"
system (3600508b4001078340000d00004c10000) dm-0 HP,HSV210
[size=25G][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=100][active]
 \_ 0:0:6:1 sdc 8:32  [active][ready]
 \_ 0:0:7:1 sdd 8:48  [failed][faulty]
 \_ 1:0:6:1 sdg 8:96  [active][ready]
\_ round-robin 0 [prio=20][enabled]
 \_ 0:0:4:1 sda 8:0   [active][ready]
 \_ 0:0:5:1 sdb 8:16  [failed][faulty]
 \_ 1:0:4:1 sde 8:64  [active][ready]

We see that this block device is still operating, but that two paths have been removed, one from each fabric. The unpresented devices are sdb and sdd, thus to remove them:

# multipathd -k"del path sdb"

# multipathd -k"del path sdd"

Then remove the devices from the kernel block device list:

# echo 1 > /sys/block/sdb/device/delete

# echo 1 > /sys/block/sdd/device/delete

Finally, restart multipathd:

# /etc/init.d/multipathd restart

# multipath -ll

system (3600508b4001078340000d00004c10000) dm-0 HP,HSV210
[size=25G][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=100][active]
 \_ 0:0:6:1 sdc 8:32  [active][ready]
 \_ 1:0:6:1 sdg 8:96  [active][ready]
\_ round-robin 0 [prio=20][enabled]
 \_ 0:0:4:1 sda 8:0   [active][ready]
 \_ 1:0:4:1 sde 8:64  [active][ready]

Alternative (untested!) approach

If things get really stuck, then you might have some luck with dmsetup.

If "multipath -ll" shows failed disks (that have been unpresented properly), use dmsetup to remove the failed disk with the command:

# dmsetup remove <device>

where <device> is "mpath<num>".

Find the stuck one from the output of multipath -ll; be sure you've got the right mpath device. Optionally, if you've got stuck lvmdiskscan or pvdisplay type processes (trying to access the missing disk), then the "remove" will fail, claiming the device is in use (which, in some senses, it is).

In this case, double check you've got the right mpath device (otherwise you'll fsck your system), and run:

# dmsetup remove \--force <device>

This will claim failure (device-mapper: remove ioctl failed: Device or resource busy), but if you now run # dmsetup info <device>

then you'll see the "Open count" has gone to zero.  You can now run the plain remove one more time:

# dmsetup remove <device>

and it will be removed.

Your hung processes will finally die the death they deserve, and the unpresented disk will be unknown to the system any longer.