Removing a persistent iSCSI connection
Kill the iSCSI session
First, find the session you're trying to delete:
sudo iscsiadm -m session
The key information is also available from the iSCSI server itself (using the equallogic cluster as an example):
sudo iscsiadm -m discovery -t st -p 10.2.0.201
The iqn number is the key from the command output. To disconnect the session:
sudo iscsiadm -m node -T <iqn> -p 10.2.0.201 -u
This is only the first skirmish of the battle, however, as the iscsi subsystem is rather persistent about keeping its connections alive and restoring them after a reboot. To prevent the session from re-establishing, you may wish to remove the node:
sudo iscsiadm -m node -o delete -T <iqn>
Once this is complete, make sure the session is no longer listed:
sudo iscsiadm -m session
If required (it is extreme, but may be necessary), you can also delete the targets from the ISCSI discovery database entirely.
sudo iscsiadm -m discoverydb -t sendtargets -p 10.2.0.201 -o delete
Finally, clean out the state information to ensure Linux does not try to re-establish the connection on future boot operations.
ls /var/lib/iscsi/nodes/<iqn>
If the <iqn> exists, delete it:
sudo rm -rf /var/lib/iscsi/nodes/<iqn>
Excerpted and adapted from https://support.unitrends.com/hc/en-us/articles/360013269518-Remove-ISCSI-sessions-using-the-Linux-command-line