RHEL6 – How to Manually Logout of an Iscsi Disk

Little_cartoon_spider_in_front_of_full_moon_sticker-p217682891349294915envb3_400One of the issues that I have run into in the past when working with iscsi disks occurs when a host (initiator) is unable to logout gracefully from an iscsi disk when attempting to shutdown or reboot a host.

Note that this is a known issue and is documented here and here. I have not read completely through the RHEL 6 Bugzilla to see if the issue has been resolved, however I can tell you that I have seen this issue in RHEL 6.2.

Anyway as a quick work around to save yourself a painfully slow reboot you can logout of the disk before you shutdown to save time, for example, if you were taking some sort of linux test.

First think I do is verify that I actually currently am logged into an iscsi session

# iscsiadm -m session
tcp: [1] 10.1.224.34:3260,1 iqn.2012-08.my.new.iscsi

Next I umount the mounted filesystem that was on the iscsi disk. In my case I mounted it to /iscsi_disk

UUID="4f3f136d-1f90-4e1b-95b6-d3496d54da99"             /iscsi_disk             ext4    defaults,_netdev 0 0

Above is the line in my /etc/fstab that mounts the iscsi disk, note that you should always use the _netdev option to mount a remote disk (nfs, san, iscsi — does not matter)

So after unmounting the disk I manually log out from the iscsi disk/s

iscsiadm -m node --logout all

The output of the command above shows me that the logout was successful.

Logging out of session [sid: 1, target: iqn.2012-08.my.new.iscsi, portal: 10.1.224.34,3260]
Logout of [sid: 1, target: iqn.2012-08.my.new.iscsi, portal: 10.1.224.34,3260] successful.

I can then check my current connected sessions again and see that I have no active sessions.

# iscsiadm -m session
iscsiadm: No active sessions.

Now you should be able to reboot without issue.

As a side note I was actually wondering how the initiator knew to log back into the iscsi disk at boot time. Well if you look in /var/lib/iscsi/nodes/ you will see a directory for each iscsi disk that you logged into using iscsiadm.

Comments

One response to “RHEL6 – How to Manually Logout of an Iscsi Disk”

  1. rtt Avatar

    Very useful I made an overall Centos 7 iSCSI guide if you are interested. Most things are basically the same for 6 and iSCSI.

Leave a Reply