When you’ve finished using a remote iSCSI LUN and no longer need it mounted on your CentOS/RHEL host, it’s important to cleanly remove the target so it won’t automatically reconnect on reboot or leave stale configuration behind. In this guide you’ll learn how to:

  • Safely unmount any filesystems on the iSCSI device

  • Log out of the target session to stop the active connection

  • Delete the target’s persistent record from the local iSCSI database

  • (Optionally) Disable the iSCSI service if no targets remain

By following these steps, you’ll ensure your initiator stays tidy and free of unused targets, reducing the risk of future mount conflicts or unexpected reconnections. For related troubleshooting tips when diagnosing iSCSI connectivity problems, see our “How to troubleshoot iSCSI issues in CentOS / RHEL 6,7” guide

 

1. Umount iSCSI device/filesystems

 

Before deleting the target, make sure the iSCSI devices from that target are not in use. Umount and/or delete the filesystems using the iSCSI devices esported from the target.

 

2. Logout

 

First step is to logout of the iSCSI target.

# iscsiadm -m node -T iqn.2007-06.com.test.geeklab:storage.geeklab --portal 192.168.10.12:3260 -u

 

3. Delete Target’s Record ID

 

When you discover the targets and log into it, the information is stored in the node database found in /var/lib/iscsi. In order to delete the target, we have to delete the target’s record ID out of /var/lib/iscsi:

# iscsiadm -m node -o delete -T iqn.2007-06.com.test.geeklab:storage.geeklab --portal 192.168.10.12:3260

 

4. Stop the iSCSI service (optional)

 

Follow this step only if you have no other target left on the system and do not want to use iSCSI. Stop the iSCSI service and disable it to start at boot using chkconfig or systemctl commands.

 

For RHEL 6

 

# service iscsi stop</
# chkconfig iscsi off

 

For RHEL 7

 

# systemctl stop iscsi
# systemctl disable iscsi

 

Дали Ви помогна овој одговор? 0 Корисниците го најдоа ова како корисно (0 Гласови)