new1234.jpg
Home > VMware > VMware: Detach unmounted datastores with PowerCLI

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 over 15 years experience in IT, primary focus: virtualization and modern worksplace.

More Posts - Website

Follow Me:
TwitterLinkedIn

Categories: VMware Tags: , , ,
  1. October 31st, 2014  (Quote) at 01:58  (Quote) | #1

    WOW just what I was searching foг. Came here by searching foг
    datastore

  2. Bill
    November 7th, 2014  (Quote) at 19:57  (Quote) | #2

    I keep getting Unmount-Datastore is not recognized as the name of a cmdlet. Do I need to load a lib?

    Bill

  3. November 8th, 2014  (Quote) at 18:35  (Quote) | #3

    Great post.

  4. November 16th, 2014  (Quote) at 11:46  (Quote) | #4

    very good

  5. December 16th, 2014  (Quote) at 21:19  (Quote) | #5

    @Bill

    Bill,
    You need to load the functions into your PowerCLI console. You can download them here….

    https://communities.vmware.com/docs/DOC-18008

  6. vmware_admin
    February 26th, 2015  (Quote) at 21:03  (Quote) | #6

    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?

  7. January 26th, 2016  (Quote) at 16:53  (Quote) | #7

    very good

  1. at | #1