How to remve an ISCSI disk from linux server without reboot

root's picture

Following I want to remove an unused disk, in our example it is "backups":

root@pluto:~# iscsiadm -m discovery -t sendtargets -p,1,1,1
root@pluto:~# fdisk -l /dev/sdc

Disk /dev/sdc: 375.8 GB, 375809638400 bytes
255 heads, 63 sectors/track, 45689 cylinders, total 734003200 sectors
Units = sectors of 1 * 512 = 512 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk identifier: 0x00000000

Disk /dev/sdc doesn't contain a valid partition table

So you know the disk, all you have to do is to use the option -u against it:

iscsiadm -m node --targetname -u

The command output should look as follows:

root@pluto:~# iscsiadm -m node --targetname -u
Logging out of session [sid: 2, target:, portal:,3260]
Logout of [sid: 2, target:, portal:,3260] successful.

Note: no output on fdisk command is exactly what we wanted.


Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.