At a high level, we will go through these steps to unmount a datastore from an ESXi host. The procedure extends to cover how to detach a datastore with an extent attached.
- Step 1 – Evacuate all the VM’s and files
- Step 2 – Unmount the datastore
- Step 3 – Detach the LUNs from ESXi host
- Step 4 – Remove from vCenter inventory
- Step 5 – Unmap the LUN from Storage Array
- Step 5 – Rescan the adapters
Pre-unmount checklist
- Verify if the datastore has multiple lun extents ( device backing )
- Storage vMotion all objects – Virtual machines, snapshots, and templates
- Verify all the files under the datastore – sometimes there will be ISO files in there.
- Verify if the hosts have a vSAN configuration enabled on them such as ISCSI or NFS vSAN services.
- Verify VM Storage policies,if any on the datastore. If so, remove it
- Verify if the datastore is part of a vCloud Director configuration and see if there are tags assigned to it
- Verify if datastore is part of a journal repository or being used by Zerto/ vRA / SRM etc
- Datastore should not be used as a diagnostic coredump partition.
- Datastore should not be used for storing ESXi host logs.
- Datastore should not be used as scratch partition.
- Ensure the datastore is not used for vSphere HA heartbeat.
- Ensure the Datastore is not part of a Datastore cluster and not controlled by Storage DRS.
- Storage I/O control should be disabled on the datastore.
- Verify If the LUN is being used as an RDM, remove the RDM from the virtual machine. Click Edit Settings, highlight the RDM hard disk, and click Remove.
- Select delete from disk if it is not selected and click OK. This destroys the mapping file, but not the LUN content.
Procedure to Remove Datastore
In this example, we are attempting to remove a VMFS datastore that has multiple extents on it.
There are several ways to get this info but the easiest and by far the most efficient way to get host connectivity is via the Storage tab. Under Storage View > Select Datastore -> Go to Connectivity and Multipathing which will show all our hosts and the path selection policy applied. Note down the naa id for that datastore and the lun id
Click the arrow shown which will drop the pull list if any extents are present on the datastore. As seen we have an odd extent on this datastore
Select the Device and we can see the NAA ID of the second disk and its lun number
Make a note of the NAA ID, VM ID of the datastore, lun, and put it into an excel format as shown, we are to use this information later in this procedure.
Datastore Name | LUN Name | LUN ID | Size | NAA-ID | Mount Point |
iSCSI-Datastore-2 | Datastore-2 | 1 | 1TB | naa.60003ff44dc75adc88991d9b54245476 | vmfs/volumes/60e5e790-0adcf977-a66f-00505694fdb8/ |
iSCSI-Datastore-2 | Datastore-3 | 2 | 100G | naa.60003ff44dc75adc88991d9b54245476 | vmfs/volumes/60e5e790-0adcf977-a66f-00505694fdb8/ |
Verify if there are VM’s in the datastore
Verify if there are files in the data store such as ISO’s etc
Remove the datastore from HA configuration
Remove the datastore from VM Storage policies if any
Remove Storage Tags if any
Select the datastore to remove, place the datastore in maintenance mode
If the datastore wasn’t part of multiple extents you could just go directly to an esx host and Detach the lun but in this case, it will fail as you need to detach on a per datastore basis. Lets give that a try
As expected it fails because the other disk is still part of this datastore
Now right-click the datastore to remove, right-click and select Unmount
Confirm Datastore unmount and click on OK.
Monitor the recent tasks and Wait till the VMFS volume shows as Inaccessible
Select the ESXi host-> Configuration-> Storage-> Devices datastore. Right-click the device and Detach.
As seen we can one disk extent will be showing as Not Consumed so we can Detach both the disk now
Click Detach and Select detach from multiple hosts
Repeat the above action for the second disk as well
Lun with device backing/ extent has thus been detached from the esx hosts
On the storage array, unmap the lun from the ESXi hosts. We aren’t covering it here but this is something we will cover in our SAN topics
Once the luns are unmapped from the storage array, rescan the ESXi host adapter and verify detached LUNs no longer appear in vCenter inventory. The easiest way to do this via the Storage Section and Rescan Storage than going individually to hosts and perform an HBA scan
Select both these options
That’s it – Our datastore is thus removed from esx and vCenter inventory
References
https://kb.vmware.com/s/article/2004605