Sunday, March 16, 2014

Removing LUNS and Datastores on ESXi Hosts 5.0 and above

We had a need to remove the LUNS from one of our SANS. If you go to your iSCSI Software Adapter and remove the SAN IP's from the properties (Dynamic and Static tabs), you will have issues when the ESXi host rescans the HBA's and VMFS stores. The reason is because you didn't remove the datastores from the host. The proper order to do this is:


  1. Unmount the datastore from each host
  2. Detach the LUNS from each host
  3. Remove the iSCSI IP's of the SAN from your iSCSI Software Adapter (or appropriate adapter)

Unmount The Datastore From Each Host
To do this you will need to go to the Datastore view and find the datastores attached to the LUNS. Right click and select unmount. A screen will come up letting you know if you can unmount the datastore. You should remove all VM's and it can't be part of a datastore cluster.

When you unmount the datastores it will ask you which hosts to remove them from. This saves time from having to go to each host and unmount.


Detach The LUNS From Each Host
To do this you will need to go to your configuration tab and then select Storage adapters. Select your storage adapter (mine is the iSCSI software adapter).

When you select your storage adapter you will see all of the LUNS on the bottom. Find the LUNS that you want to remove and right click and then select detach. Make sure you are selecting the right ones.

I had to to this for each host and each LUN. It took me a few minutes. I don't see an option to do this for all the hosts at the same time like we did with the unmounting of the datastore.


Remove The iSCSI IP's of the SAN From Your iSCSI Software Adapter (Or Appropriate Adapter)
Still inside your Configuration tab and Storage Adapter, right click your iSCSI Software Adapter and select properties. Go to Static entried and remove the IP's one at a time of your SAN. Do the exact same for the Dynamic tab. Once you do that click CLOSE and have it rescan.

The reason you want to go through all of this is because the datastores that are still mounted on those LUNS will cause issues if you just remove the IP's from the storage adapter. When it rescans it will take forever and could cause it to lose connection to the vCenter. Since the datastores were not unmounted the ESXi host doesnt know what to do and keeps trying to access it.

If you don't have any datastores on those LUNS, then you should be able to remove the IP's from the storage adapter and rescan.

No comments:

Post a Comment

Error 1312 when adding ssl cert

 If you get an error when using netsh to add a cert thumbprint, make sure you have a private key attached to the cert. Also, make sure the c...