How to do Lun reset and target reset on RHEL 6.x and 7.x OS version ?

LUN reset - Resets the specified LUN by clearing any reservation on the LUN and making the LUN available to all servers again. The reset does not affect any of the other LUNs on the device. If another LUN on the device is reserved, it remains reserved.

Target reset - Resets the entire target. The reset clears any reservations on all the LUNs associated with that target and makes the LUNs available to all servers again.

Make sure if below package is installed on your RHEL host:

# rpm -qa | grep sg3
sg3_utils-libs-1.37-12.el7.x86_64
sg3_utils-1.37-12.el7.x86_64

"sg_reset" command comes bundled with "sg3_utils" package, so install it if not installed already. 

Get the wwid for the device which needs to be reset:

# multipath -ll

360002ac000000000000000820001cb64 dm-23 3PARdata,VV
size=2.5T features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 0:0:0:5  sdj  8:144  active ready running
  |- 3:0:0:5  sdl  8:176  active ready running
  |- 0:0:1:5  sdaw 67:0   active ready running
  `- 3:0:1:5  sdax 67:16  active ready running


LUN Reset (--device | -d):

# sg_reset -d /dev/mapper/360002ac000000000000000820001cb64


# tail -f /var/log/messages

Dec  8 23:28:00 rhel74 kernel: qla2xxx [0000:83:00.0]-8009:0: DEVICE RESET ISSUED nexus=0:0:5 cmd=ffff88085cd3f640.
Dec  8 23:28:00 rhel74 kernel: qla2xxx [0000:83:00.0]-800e:0: DEVICE RESET SUCCEEDED nexus:0:0:5 cmd=ffff88085cd3f640.


Target Reset (--target | -t):


# sg_reset -t /dev/mapper/360002ac000000000000000820001cb64


# tail -f /var/log/messages

Dec  8 23:28:40 rhel74 kernel: qla2xxx [0000:83:00.0]-8009:0: TARGET RESET ISSUED nexus=0:0:5 cmd=ffff881059b4da40.
Dec  8 23:28:40 rhel74 kernel: qla2xxx [0000:83:00.0]-800e:0: TARGET RESET SUCCEEDED nexus:0:0:5 cmd=ffff881059b4da40.


If still you are seeing issues with SCSI reservation conflicts, you can use "--bus | -b" option

It resets all accessible targets on the bus. The reset clears any SCSI reservation on all the LUNs accessible through the bus and makes them available to all servers again.

Comments

Post a Comment

Popular posts from this blog

Recover or restore initramfs file in RHEL or CentOS 7

Space reclamation / UNMAP on RHEL or CentOS 7

How to recover /boot partition on RHEL or CentOS 7?