Hello,
I am evaluating VM deployment methods and am looking at PowerCLI. I am new to vSphere and am seeing a behavior which I do know is expected or not so I'm hoping for some help sorting this out.
Using PowerCLI 10 latest version against vSphere 6.5.0.13000, I create a new VM such as:
$vm = New-VM -ResourcePool $cluster -Datastore $ds -Name $vmName -HardwareVersion vmx-13 -GuestId windows9Server64Guest -MemoryMB 8192 -NumCpu 4 -CoresPerSocket 1 -Portgroup $portGroup
This command yields two different directories created on the Datastore:
$vm.ExtensionData.Config.files VmPathName : [ds-gen9-vm-01] 0032e35a-4804-5eeb-136e-9cdc714b31d0/BEB-02.vmx SnapshotDirectory : [ds-gen9-vm-01] 0032e35a-4804-5eeb-136e-9cdc714b31d0/ SuspendDirectory : [ds-gen9-vm-01] 0032e35a-4804-5eeb-136e-9cdc714b31d0/ LogDirectory : [ds-gen9-vm-01] 0032e35a-4804-5eeb-136e-9cdc714b31d0/ FtMetadataDirectory :
and:
dir vmstore:\LAB\ds-gen9-vm-01\BEB-02 Name Type Id ---- ---- -- .sdd.sf DatastoreFolder .dvsData DatastoreFolder BEB-02.vmdk DatastoreFile BEB-02.vmx DatastoreFile BEB-02.vmsd DatastoreFile BEB-02-0172bd4d.hlog DatastoreFile
The .VMX file is in two locations.
Also,
When I add an additional virtual hard disk using the New-HardDisk cmdlet,
it is created within the VmPathName directory, NOT the BEB-02 directory where the
original VMDK file was created.
Any explanation and documentation references would be appreciated.
I would think you would want all VM related files to be located under a single folder
with the VM name for easy management and support of the environment. If this is possible
how do I enable it?
Thank you for your help with this.
Brian
So it looks indeed as if the same folder is reachable over the 2 names.
It is annoying that internally in the VM it seems to point to less user-friendly name, and not the folder with the VM's DisplayName.
My suspicion that this is a kind of symbolic link seems to be confirmed in Re: VM folder name shows up as UUID name on vSandatastore
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is quite confusing since you collapsed both outputs into a one-liner.
What does the File Browser in the Web Client show when you go onto datastore ds-gen9-vm-01], and into folder BEB-02?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Sorry about that, I guess I was trying to make things readable and perhaps I went too far and did the opposite.
So I am changing my question -- what is the purpose of this working directory? Is it in fact a duplicate, an hard link/alias, or a starting point for new changes (since the VM has not been powered on yet).
PS vmstore:\LAB\ds-gen9-vm-01> ls 6d6be35a-1815-280f-2b15-9cdc714b31d0 -recurse
Name Type Id
---- ---- --
50 26 11 16 af 09 7f 0a-b5 ... DatastoreFolder
.sdd.sf DatastoreFolder
.dvsData DatastoreFolder
BEB-03.vmdk DatastoreFile
BEB-03.vmx DatastoreFile
BEB-03_1.vmdk DatastoreFile
66 DatastoreFile
BEB-03-46c3e6a7.hlog DatastoreFile
BEB-03.vmsd DatastoreFile
PS vmstore:\LAB\ds-gen9-vm-01> ls BEB-03 -recurse
Name Type Id
---- ---- --
50 26 11 16 af 09 7f 0a-b5 ... DatastoreFolder
.sdd.sf DatastoreFolder
.dvsData DatastoreFolder
BEB-03.vmdk DatastoreFile
BEB-03.vmx DatastoreFile
BEB-03_1.vmdk DatastoreFile
BEB-03-46c3e6a7.hlog DatastoreFile
BEB-03.vmsd DatastoreFile
66 DatastoreFile
No problem.
I have the impression that both names are pointing to the same folder. Could be some kind of symbolic link.
Some more questions:
Get-ChildItem 6d6be35a-1815-280f-2b15-9cdc714b31d0 | select DatastoreFullPath,Length,LastWriteTime
Get-ChildItem BEB-03 | select DatastoreFullPath,Length,LastWriteTime
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This datastore is vSAN 6.6.
Here's the extra info:
PS vmstore:\LOE_LAB\ds-gen9-vm-01> Get-ChildItem 6d6be35a-1815-280f-2b15-9cdc714b31d0 | select DatastoreFullPath,Length,LastWriteTime
DatastoreFullPath Length LastWriteTime
----------------- ------ -------------
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/.sdd.sf 4/27/2018 2:26:53 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/.dvsData 4/27/2018 2:26:53 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03.vmdk 493 4/27/2018 2:26:54 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03.vmx 1456 4/27/2018 4:07:12 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03_1.vmdk 523 4/27/2018 4:07:12 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03-46c3e6a7.hlog 293 4/27/2018 2:26:54 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03.vmsd 0 4/27/2018 2:26:54 PM
PS vmstore:\LOE_LAB\ds-gen9-vm-01> Get-ChildItem BEB-03 | select DatastoreFullPath,Length,LastWriteTime
DatastoreFullPath Length LastWriteTime
----------------- ------ -------------
[ds-gen9-vm-01] BEB-03/.sdd.sf 4/27/2018 2:26:53 PM
[ds-gen9-vm-01] BEB-03/.dvsData 4/27/2018 2:26:53 PM
[ds-gen9-vm-01] BEB-03/BEB-03.vmdk 493 4/27/2018 2:26:54 PM
[ds-gen9-vm-01] BEB-03/BEB-03.vmx 1456 4/27/2018 4:07:12 PM
[ds-gen9-vm-01] BEB-03/BEB-03_1.vmdk 523 4/27/2018 4:07:12 PM
[ds-gen9-vm-01] BEB-03/BEB-03-46c3e6a7.hlog 293 4/27/2018 2:26:54 PM
[ds-gen9-vm-01] BEB-03/BEB-03.vmsd 0 4/27/2018 2:26:54 PM
This seems to be persistent -- the items were identical after exiting and starting a new PowerCLI session. And when I started the VM, the files remained in sync with the nvram file appearing and the vmx file timestamp changing:
PS vmstore:\LOE_LAB\ds-gen9-vm-01> Get-ChildItem BEB-03 | select DatastoreFullPath,Length,LastWriteTime
DatastoreFullPath Length LastWriteTime
----------------- ------ -------------
[ds-gen9-vm-01] BEB-03/.sdd.sf 4/27/2018 2:26:53 PM
[ds-gen9-vm-01] BEB-03/.dvsData 4/27/2018 2:26:53 PM
[ds-gen9-vm-01] BEB-03/BEB-03.vmdk 493 4/27/2018 2:26:54 PM
[ds-gen9-vm-01] BEB-03/BEB-03.vmx 2327 4/27/2018 4:40:55 PM
[ds-gen9-vm-01] BEB-03/BEB-03.nvram 74232 4/27/2018 4:40:54 PM
[ds-gen9-vm-01] BEB-03/BEB-03_1.vmdk 523 4/27/2018 4:07:12 PM
[ds-gen9-vm-01] BEB-03/vmware-1.log 204997 4/27/2018 4:39:59 PM
[ds-gen9-vm-01] BEB-03/vmware.log 204313 4/27/2018 4:40:55 PM
[ds-gen9-vm-01] BEB-03/BEB-03-46c3e6a7.hlog 293 4/27/2018 2:26:54 PM
[ds-gen9-vm-01] BEB-03/BEB-03.vmsd 0 4/27/2018 2:26:54 PM
PS vmstore:\LOE_LAB\ds-gen9-vm-01> Get-ChildItem 6d6be35a-1815-280f-2b15-9cdc714b31d0 | select DatastoreFullPath,Length,LastWriteTime
DatastoreFullPath Length LastWriteTime
----------------- ------ -------------
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/.sdd.sf 4/27/2018 2:26:53 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/.dvsData 4/27/2018 2:26:53 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03.vmdk 493 4/27/2018 2:26:54 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03.vmx 2327 4/27/2018 4:40:55 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03.nvram 74232 4/27/2018 4:40:54 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03_1.vmdk 523 4/27/2018 4:07:12 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/vmware-1.log 204997 4/27/2018 4:39:59 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/vmware.log 204313 4/27/2018 4:40:55 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03-46c3e6a7.hlog 293 4/27/2018 2:26:54 PM
[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0/BEB-03.vmsd 0 4/27/2018 2:26:54 PM
So it looks indeed as if the same folder is reachable over the 2 names.
It is annoying that internally in the VM it seems to point to less user-friendly name, and not the folder with the VM's DisplayName.
My suspicion that this is a kind of symbolic link seems to be confirmed in Re: VM folder name shows up as UUID name on vSandatastore
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
And of course William (who else) has a handy function to convert between the two.
See Translating vSAN VM Object IDs (UUID to VM and VM to UUID)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD
Thank you for the great info. Our VMware/vSAN journey has just begun and thanks for getting me over this first hurdle!