How to remove a HyperStore storage server from ESXi - command line mode

If do not want to just 'click click' on your VMware to remove an HyperStore storage servers mounted via iSCSI you can do the following

Published on: May 11, 2020 by Website Admin

If you just want to remove a iSCSI HyperStore storage server from your ESXi shell command line you do the following:

esxcli iscsi adapter discovery sendtarget remove --address <<your-ip-addres-goes-here>> --adapter=`esxcli iscsi adapter list|grep -i software|cut -f 1 -d " "`;

Why is this important?

Well you have a few ESXi blades it's OK and recommended (as far as I know) to umount the HyperStore storage server (FreeNAS or what ever you have) using the VMware console GUI. But when you have a hundreds of ESXi blades it's a bit time consuming to do that.

Other important notice

I truly hope you do not have any active servers on that HyperStore storage server. You remove those first or migrate them via VMware.

After you have removed the IP (or IPs - as usually the SCSI targets are mounted via 2 fibers, each with it's own switch and IP), you now have to run the rediscover and rescan on the ESXi. For that use the following commands:

esxcli iscsi adapter discovery rediscover --adapter=`esxcli iscsi adapter list|grep -i software|cut -f 1 -d " "`;
and...
esxcli storage core adapter rescan --adapter=`esxcli iscsi adapter list|grep -i software|cut -f 1 -d " "`

All the above have been tested on ESXi 5 and 6.

That's it!