Datastores in ESX hosts are made up of extents. Extents can be thought of as the underlying physical disk/ LUN that goes into making up the datastore.
A datastore is usually made up of a single extent, but can span multiple extents too. So removing a datastore from an ESX hosts means you dismount the datastore and then detach the extents.
Datastores have friendly names that you assign when creating it. Extents have names that usually start with naa
or eui
.
In vSphere client when you select a host, go to its Configuration tab, Storage, select Datastores view – the “Identification” column shows the datastore name and the “Device” column shows the extent name.
In PowerCLI the same information can be seeing using Get-View
or the ExtensionData
property object of a datastore object (as in my previous post).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
PowerCLI C:\> (get-datastore DATA01).ExtensionData.Info.Vmfs BlockSizeMb : 1 MaxBlocks : 63963136 MajorVersion : 5 Version : 5.58 Uuid : 55ca1ec0-141dffed-06c0-0017a477137c Extent : {naa.50002ac0000000000000000200014735} VmfsUpgradable : False ForceMountedInfo : Ssd : False Local : False Type : VMFS Name : DATA01 Capacity : 2198754820096 |
Anyways, to remove a datastore from an ESX host you first go to the Datastores screen as above, select the datastore, right click and select “Unmount”. This will do a bunch of checks (such as whether any VMs running on that host have their disks on this datastore) and then let you unmount it. This only removes the datastore name from the ESX host though; the host can still see and mount the datastore. So the next step is to also detach the extent from the host – i.e. unpresent the underlying disk/ LUN from the host.
For this you need the extent names. Get these as above (by expanding the “Device” column to see the name; or use PowerCLI). Then go to the Devices view (instead of the Datastores view that you currently are on). Expand the “Identifier” column now and find the extents that we want to detach. Once you find this right click and select “Detach”. This too does some checks and then lets you detach the extent if it’s not in use.
That’s it.
p.s. Too lazy to take screenshots. Sorry about that. :)