Tuesday, February 21, 2017

The Rare un-iSCSI Commands

I often add iSCSI volumes to Linux servers but, until now, rarely take them away.  That strikes me as odd too.  But, I guess when I get to the point of not using storage, the server is usually going away too.  -Not in this case. 

So, here's the steps for removing all traces of an iSCSI volume.

Step 1: Find the iSCSI Session

[root@localhost]# iscsiadm -m session
tcp: [1] 192.168.0.100:3260,1 iqn.2001-05.com.emc:0-af1ff6-c57ac0bd5-712a2878fd0
533c6-backuppc (non-flash)

Step 2: Disable (logout) current iSCSI session

[root@localhost]# iscsiadm --m node -T iqn.2001-05.com.emc:0-af1ff6-c57ac0bd5-71
2a2878fd0533c6-backuppc --portal 192.168.0.100:3260 -u
Logging out of session [sid: 1, target: iqn.2001-05.com.emc:0-af1ff6-c57ac0bd5-7
12a2878fd0533c6-backuppc, portal: 192.168.0.100,3260]
Logout of [sid: 1, target: iqn.2001-05.com.emc:0-af1ff6-c57ac0bd5-712a2878fd0533
c6-backuppc, portal: 192.168.0.100,3260] successful.


Step 3: Double check that session is logged out

[root@localhost]# iscsiadm -m session                                   iscsiadm
: No active sessions.

Step 4: Permanently delete iSCSI session

[root@localhost]# iscsiadm -m node -o delete -T iqn.2001-05.com.emc:0-af1ff6-c57
ac0bd5-712a2878fd0533c6-backuppc --portal 192.168.0.100:3260


Step 5: Stop iSCSI from running (since targets are gone)

[root@localhost]# service iscsi stop
Stopping iscsi:                                            [  OK  ]            
[root@localhost]# chkconfig iscsi off

Step 6: Remove references to iSCSI in /etc/fstab

[root@localhost]# vi /etc/fstab ...

No comments: