VMware: Detach unmounted datastores with PowerCLI

8

Last week I  had some issues with unmounting some old datastores in a vSphere 5.5 environment. In the GUI it look like:

image

When I tried to unmount / detach the datastore I received this error message::

Call “HostDatastoreSystem.RemoveDatastore” for object “datastoreSystem-330” on vCenter Server “itvvca01.domain.local” failed.
Operation failed, diagnostics report: Unable to query live VMFS state of volume.: No such file or directory

More information:

image

SAN01_VMFS04 datastore state accessible: false….

image

 

Solution:

You can easy detach the inaccessible datastores with the following command:

Get-Datastore SAN01_VMFS0* | Unmount-Datastore

Or per specific datastore:

Get-Datastore SAN01_VMFS01 | Unmount-Datastore

Get-Datastore SAN01_VMFS02 | Unmount-Datastore

More information: VMware

About Author

8 thoughts on “VMware: Detach unmounted datastores with PowerCLI

  1. First – thank you for sharing this!
    I have a basic question – how would i go about using this library? I have powerCLI intsalled and connected to vCenter. I’ve looked around but not able to execute any commands. Clearly i’m mis-reading.

    any insight on how I can use the commands in the script?

  2. Pingback: Sander

Leave a Reply

Your email address will not be published. Required fields are marked *