manintheit.org

manintheit.org


Removing and Rescanning SCSI Disk

Hi, Sometimes storage team needs to upgrade HBA and Storage. During that time some of the multipath may not active. In this circumstance, as a system administrator, It is safe to set the device offline manually instead of immediate disk path failure before any HBA and storage upgrade happen.

multipath -ll
mpathb (1IET     00010001) dm-2 IET,VIRTUAL-DISK
size=1020M features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| `- 2:0:0:1 sdb 8:16 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
  `- 3:0:0:1 sdc 8:32 active ready running

In this post I will use /dev/sdb for the disk operation. Setting the device offline disk: In this case I will set offline the /dev/sdb.

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

Checking Disk State:

[root@node02 ~]# cat /sys/block/sdb/device/state 
offline

In order to update multipath devices, we need to flush multipath and rescan it. (multipath -F; multipath)

[root@node02 ~]# multipath -F;multipath
Oct 18 23:00:35 | mpatha: ignoring map
create: mpathb (1IET     00010001) undef IET,VIRTUAL-DISK
size=1020M features='0' hwhandler='0' wp=undef
`-+- policy='round-robin 0' prio=1 status=undef
  `- 3:0:0:1 sdc 8:32 undef ready running

multipath -ll
mpathb (1IET     00010001) dm-2 IET,VIRTUAL-DISK
size=1020M features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
  `- 3:0:0:1 sdc 8:32 active ready running

After the storage and HBA operation we set the device running state again. Setting the device to running state.

echo running > /sys/block/sdb/device/state
[root@node02 etc]# cat /sys/block/sdb/device/state 
running

Checking multipath after setting the device to  running state.

[root@node02 etc]# multipath -ll -v2
size=1020M features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=enabled
| `- 2:0:0:1 sdb 8:16 active ready running
`-+- policy='round-robin 0' prio=1 status=active
  `- 3:0:0:1 sdc 8:32 active ready running

  Deleting a disk device Sometimes we do not need to a disk device. In this case we need to delete disk device. For safety It is highly recommended setting device to offline before deleting a disk device.

[root@node02 etc]# echo offline > /sys/block/sdb/device/state

Deleting the device

echo 1 > /sys/block/sdb/device/delete
[root@node02 etc]# fdisk -l /dev/sdb

If you want to add the disk again: Rescan the disk

echo "- - -" > /sys/class/scsi_host/host2/scan

dmesg output.

sd 2:0:0:1: [sdb] Attached SCSI disk
multipath -ll
mpathb (1IET     00010001) dm-2 IET,VIRTUAL-DISK
size=1020M features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| `- 2:0:0:1 sdb 8:16 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
  `- 3:0:0:1 sdc 8:32 active ready running


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.