VMware: Detach unmounted datastores with PowerCLI

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

sanderdaems

Sander Daems is founder and author of this blog and working as a Lead (Sr.) Consultant by UNICA ICT Solutions. Sander has 15+ years experience in IT, primary focus: virtualization and modern worksplace.

More Posts - Website

Follow Me:
TwitterLinkedIn

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 *