Disk

 

 


Removing a Path to a Storage Device

 

 * Removal of a storage device is not recommended when the system is under memory pressure,

   since the I/O flush will add to the load. (vmstat 1 100)

Step

1. umount

2. 在 MD 或 LVM (pvmove , vgreduce) 移除

3. This is important for raw devices, where there is no umount or vgreduce operation to cause an I/O flush.

blockdev --flushbufs device

4. Remove PATH

  • /dev/sd?
  • /dev/disk/by-path
  • major:minor

# This will cause any subsequent I/O sent to the device on this path to be failed immediately.

# Device-mapper-multipath will continue to use the remaining paths to the device.

echo offline > /sys/block/sdN/device/state

# Remove the path from the SCSI subsystem. (/dev/sd?)

echo 1 > /sys/block/device-name/device/delete

i.e.

echo 1 >  /sys/block/sda/device/delete

echo offline > /sys/block/sda/device/state

It is not necessary to stop I/O while this is done, as device-mapper-multipath will re-route I/O to

remaining paths according to the configured path grouping and failover policies.