PowerCLI

 View Only
  • 1.  persistently force mount the datastore

    Posted Jan 19, 2012 04:36 PM

    Hello.

    I'm looking for ways to force mount the datastore in PowerCLI.
    and I found the following thread.

    Powershell ResolveMultipleUnresolvedVmfsVolumes (equivalent of esxcfg-volume.pl)

    This is exactly the sort of thing I was looking for.
    but is this script provide a persistently mounted?
    Need equivalent to "esxcfg-volume -M" option. "-m" option is not.

    Thanks



  • 2.  RE: persistently force mount the datastore

    Posted Jan 19, 2012 07:31 PM


  • 3.  RE: persistently force mount the datastore

    Posted Jan 20, 2012 03:53 AM
    Thank you very much.
    ResolveMultipleUnresolvedVmfsVolumes is always persistently mounted?
    or setting property in some place?


  • 4.  RE: persistently force mount the datastore
    Best Answer

    Posted Jan 20, 2012 07:21 AM

    I don't think it is possible to explicitely specify a persistent mount in the call to ResolveMultipleUnresolvedVmfsVolumes.

    You can check the persistence like this

    ....
    $Result = $vmHostSS.ResolveMultipleUnresolvedVmfsVolumes($HUVRSarray)
    $Result | Select @{N="Name";E={$_.vmfs.Name}},@{N="Persistent";E={$_.vmfs.forceMountedInfo.persist}}


  • 5.  RE: persistently force mount the datastore

    Posted Jan 22, 2012 05:02 PM

    I tried it.

    Name       : ds1_test
    Persistent : True

    confirmed persistently mounted.
    Thanks a lot!



  • 6.  RE: persistently force mount the datastore

    Posted Feb 09, 2012 05:38 AM

    Hello,

    First of all, thank you for all the great scripts and help over the last couple years, I appreciate it!  I have a question regarding this script posted here.  It seems that the code here is using the naa ID of the unresolved LUN to persistently mount it, is that correct?  I think the variable $extPaths that is derived represents the naa name.  Does anyone know of a way to forcemount vmfs datastores using the vmfs UUID?  I have a list of UUIDs from my production side that I would like to forcemount in my DR site, and a script to do so would be a huge improvement over going host to host using esxcfg-volume -M.  I am using ESXi 5.0 and PowerCLI 5.0.1.  Thanks in advance for any insight to get me going in the right direction.

    Sean



  • 7.  RE: persistently force mount the datastore

    Posted Feb 09, 2012 06:16 AM

    Afaik, you can only call the ResolveMultipleUnresolvedVmfsVolumes method with the canonical name (the naa. name) of the LUN.

    But it is easy to find the canonical name of a LUN starting from the UUID.

    Something like this

    $esx = Get-VMHost MyEsx 
    $tgtUuid
    = "0200050000600507670180809ed0000000000002a1323125352020"
    $CanonicalName
    = ($esx.ExtensionData.Config.StorageDevice.ScsiLun | where {$_.Uuid -eq $tgtUuid}).CanonicalName

    The value in $CanonicalName is the one to pass to the method.



  • 8.  RE: persistently force mount the datastore

    Posted Feb 09, 2012 07:47 AM

    LucD,

    Thank you for the quick reply.  I am a little confused, when I use the UUID like you jsut showed in your example (Im assuming its the LUN UUID?)  it doesnt seem to work.  Is this because the LUN UUID is different on my DR ESXI host with its different storage array?  I was thinking of using what I guess is the volume ID, one that looks something like this:

    4f0a4452-5f5a8ae5-9001-d4856423f58c

    This ID is consistent between the replicated arrays, so if I could plug that in and get the canonical name out, that seems like the way to go.  Does this make sense?  Thank you again

    Sean



  • 9.  RE: persistently force mount the datastore

    Posted Feb 09, 2012 08:15 AM

    I suspect the layout of the LUN UUID might be different depending on the storage devices behind the LUNS.

    This will list all Canonical names and corresponding UUID.

    $esx = Get-VMHost MyEsx 
    $esx
    .ExtensionData.Config.StorageDevice.ScsiLun | Select CanonicalName,Uuid

    Perhaps that will clear up your confusion