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
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}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Have a look at Power CLI equivalent to esxcfg-volume -M
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I tried it.
Name : ds1_test
Persistent : True
confirmed persistently mounted.
Thanks a lot!
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
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.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
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
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference