VMware Cloud Community
bbollard
Contributor
Contributor
Jump to solution

New-VM, datastore directory structure confusion

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

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

0 Kudos
7 Replies
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
bbollard
Contributor
Contributor
Jump to solution

LucD,

Sorry about that, I guess I was trying to make things readable and perhaps I went too far and did the opposite.

So in trying to capture all of the information again, I noticed something that I think I missed the last time hence why I was trying to get answers.

In this new test, the '[ds-gen9-vm-01] BEB-03' directory and the 'working directory'  '[ds-gen9-vm-01] 6d6be35a-1815-280f-2b15-9cdc714b31d0' directory appear to be identical. I even added a new hard disk via the New-HardDisk cmdlet and there is a BEB-03_1.vmdk file in both places.

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                      

0 Kudos
LucD
Leadership
Leadership
Jump to solution

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:

  • Is this persistent? In other words, do both folders still exists after you stop/start your PowerCLI session?
  • What type of storage is that datastore on?
  • Can you, instead of the 'ls', use Get-ChildItem (to get some more information on the files)

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

0 Kudos
bbollard
Contributor
Contributor
Jump to solution

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

 
 
Thank you,
Brian
 
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
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
bbollard
Contributor
Contributor
Jump to solution

LucD

Thank you for the great info. Our VMware/vSAN journey has just begun and thanks for getting me over this first hurdle!

0 Kudos