How to delete iscsi target from initiator ( CentOS / RHEL 7 ) Linux

How to delete iscsi target from initiator ( CentOS / RHEL 7 ) Linux

How to delete iscsi target from initiator? How to remove inactive iscsi target? Remove iscsi storage target from initiator? Remove iscsi virtual disk on CentOS / RHEL 7 Linux.

In my earlier article I shared a step by step guide to configure iscsi target and initiator to setup a multipath SAN storage using your CentOS / RHEL 7 Linux machine. In the same article I had given brief steps to remove or delete iscsi target. Anyhow here I will share the steps to delete iscsi target on CentOS / RHEL 7 Linux in detail.

 

Steps to delete iscsi target

Remove iscsci entry from /etc/fstab (if any)

Un-mount the iscsi disk

Disconnect the iscsi disk from that target

Delete the connection

Go have a beer (if you drink one)

 

Update /etc/fstab

Firstly make sure you remove the iscsi entry from /etc/fstab of the target you wish to remove.

Assuming you wish to remove the iscsi target visible as /dev/sdc from our last article. Get the UUID of /dev/sdc using blkid as shown in the below example

# blkid /dev/sdc

/dev/sdc: UUID="f87DLO-DXDO-jjJ5-3vgO-RfCE-oOCA-VGploa" TYPE="LVM2_member"

Here UUID for /dev/sdc is f87DLO-DXDO-jjJ5-3vgO-RfCE-oOCA-VGploa. So look out for this UUID in /etc/fstab and remove that entry.

 

Un-mount the disk

Now it is time to un-mount your disk before we go ahead with deleting the target. You can manually unmount the disk using umount

# umount /mount_point

Assuming /dev/sdc was mounted on /clusterfs as was on our last example, we can unmount the disk by using

# umount /clusterfs

 

Disconnect the iscsi disk from that target

If you need an iSCSI connection not to be restored after reboot, you first have to log out to disconnect the actual session by using below command

[root@node1 ~]# iscsiadm --mode node --targetname iqn.2018-12.com.example:servers  --portal 10.0.2.13 -u

Logging out of session [sid: 1, target: iqn.2018-12.com.example:servers, portal: 10.0.2.13,3260]

Logout of [sid: 1, target: iqn.2018-12.com.example:servers, portal: 10.0.2.13,3260] successful.

NOTE:
Repeat this command for every iscsi target you wish to remove/delete.

 

Delete the connection

Now is the time to delete your iscsi target connection on the initiator node.

# iscsiadm --mode node --targetname iqn.2018-03.com.golinuxcloud:tgt1 --portal 10.0.2.13 -o delete

NOTE:
Similarly repeat this command for every iscsi target which you wish to delete.

 

Stop the iscsi service (optional)

If you have deleted all the iscsi targets from your setup then you do not any additional daemon running on your initiator node.

So you can stop the iscsid daemon

# systemctl stop iscsid

# systemctl disable iscsid

IMPORTANT NOTE:
If you are deleting only some of the iscsi target, and others are still connected then do not disable or stop this service.

So all good, time to have a beer.

 

Lastly I hope the steps from the article to delete iscsi target on RHEL/CentOS 7 Linux was helpful. So, let me know your suggestions and feedback using the comment section.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值