[CentOS] can't disconnec iSCSI targets, please help

Mon Feb 28 23:02:24 UTC 2011
Dr. Ed Morbius <dredmorbius at gmail.com>

on 12:02 Mon 28 Feb, Rudi Ahlers (Rudi at SoftDux.com) wrote:
> Hi,
> 
> I'm trying to disconnect some iSCSI targets, but can't seem to.
> 
> [root at localhost ~]# iscsiadm -m session
> tcp: [1] 192.168.2.202:3260,1 iqn.2011.01.22.freenas.nvr:500gb
> tcp: [3] 192.168.2.200:3260,1 iqn.2011-2.za.co.securehosting:RAID.thin3.vg0.1tba
> tcp: [4] 192.168.2.202:3260,1 iqn.2011.01.22.freenas.nvr:extent0
> tcp: [5] 192.168.2.200:3260,1
> iqn.2011-2.za.co.securehosting:RAID.iscsi0.vg0.500gb
> 
> I need to disconnect all 4 of these
> 
> [root at localhost ~]# iscsiadm -m node -T   192.168.2.200:3260,1
> iqn.2011-2.za.co.securehosting:RAID.iscsi0.vg0.500gb -p 196.34.136.200
> --logout

That's a logout to a specific node and dataport.  If you're wrong about
the IQN and/or dataport, it's not going to work.

I think you want:

    iscsiadm -m node -u

And for good measure:

    iscsiadm -m session -u

If you do want to delete specific discovery records and need to identify
the dataport associated with them:

    iscsiadm -m discoverydb

... will print them.
 
> The target is still there, even though I tell it to disconnect.
> 
> [root at localhost ~]# iscsiadm -m session
> tcp: [1] 192.168.2.202:3260,1 iqn.2011.01.22.freenas.nvr:500gb
> tcp: [3] 192.168.2.200:3260,1 iqn.2011-2.za.co.securehosting:RAID.thin3.vg0.1tba
> tcp: [4] 192.168.2.202:3260,1 iqn.2011.01.22.freenas.nvr:extent0
> tcp: [5] 192.168.2.200:3260,1
> iqn.2011-2.za.co.securehosting:RAID.iscsi0.vg0.500gb
> 
> I can't delete it either:
> [root at localhost ~]# iscsiadm -m node --op delete --targetname
> 192.168.2.202:3260,1 iqn.2011.01.22.freenas.nvr:500gb
> iscsiadm: no records found!
> 
> Restarting iscsi gives some odd errors:

If you're going to that extent, you can umount all remote targets,
disable iscsid and iscsi services, reboot, and clear out the various
entries under /var/lib/iscsi/.  Leave the directories
(/var/lib/iscsi/*/), but remove the files beneath them.

Note that this is a bit like doing brain surgery with a sledgehammer.
Lacking in finess, but for some jobs, effective.


You might also try posting to the open-iscsi mailing list.  I've found
that iscsi is very tempermental and poorly understood by most.
 
-- 
Dr. Ed Morbius, Chief Scientist /            |
  Robot Wrangler / Staff Psychologist        | When you seek unlimited power
Krell Power Systems Unlimited                |                  Go to Krell!