Automation

 View Only
  • 1.  Unmount and Delete multiple datastore

    Posted Dec 04, 2018 09:04 PM

    Hi all,

    I have a vcenter 6.0, hosting multiple vms.

    I need to unmount and detach 100+ datastores to fulfil a storage decommission.

    VMs are already migrated.

    Am looking for  a script, that can check the pre-requisite, if pre-requisite passed, then unmount and delete the datastore.

    Could someone help me in this regard, please.

    Thankyou...



  • 2.  RE: Unmount and Delete multiple datastore

    Posted Dec 04, 2018 09:12 PM

    What kind of pre-requisite are you talking about?



  • 3.  RE: Unmount and Delete multiple datastore

    Posted Dec 04, 2018 09:19 PM

    Hi Luc,

    Prerequisite to unmount a datastore.

    Like, checking if a vm exist, SIOC enabled,part of heartbeat ...

    I need to do these prechecks for multiple datastores (100+) and then unmount and delete.



  • 4.  RE: Unmount and Delete multiple datastore
    Best Answer

    Posted Dec 05, 2018 06:00 AM

    Ok, for the pre-requisites you could use the function I provided in Test If The Datastore Can Be Unmounted

    To unmount a datastore you have to use the API methods or use the esxcli (see KB2004605) commands.

    The API methods were packaged in functions by Alan, see Datastore Mount/Unmount Detach/Attach functions

    The esxcli commands can be done through Get-EsxCli.

    Both will work, the functions have the advantage that they will make sure the datastore is unmounted on all connected ESXi nodes.

    With the esxcli commands you will have run these commands on each connected ESXi node.



  • 5.  RE: Unmount and Delete multiple datastore

    Posted Dec 07, 2018 08:27 PM

    Thanks a lot Luc,

    I was able to convert your script to fetch information from multiple datastores,at the same time,  and it worked well.