VMware Cloud Community
Alexander9712
Contributor
Contributor

PowerCLI transfers a file but the copied file size is way too small. What is wrong?

I am using PowerCLI version 6 on a Windows server with 20 GB of free space. I am trying to use copy-datastoreitem with PowerCLI. It seems to work to transfer a .vmdk file from an ESXi datastore to the Windows server that has PowerCLI. There are no error messages, but there is one problem. The .VMDK file takes up 5 GB of space in the datastore. The vSphere GUI reflects this. The copy file, on the Windows server after the PowerCLI command runs, is only 1 KB. Clearly the copy did not work correctly.

Is there another command besides the copy-datastoreitem command that works more effectively?

What would cause the file sizes to be so different? Using other PowerCLI commands, I found the 5 GB file (the source file) has the capacity for 35 GB of storage space as a VM. It is a working, non-corrupt file. The copy is not. But my PowerCLI commands have no errors. There is evidence that they work except for a huge difference in the size of the copied file. The problem is 100% reproducible.

Reply
0 Kudos
1 Reply
mattboren
Expert
Expert

Hello, Alexander9712-

It sounds like you may just be grabbing the VMDK descriptor file, and not the associated "-flat" file from the datastore.  The -flat file, as you know, is where the VM guest's data actually lives.

What is the command that you are issuing to grab the VMDK file(s)?

And, to help illustrate the fact that there are "pairs" of VMDK files (a regular descriptor file and the associated -flat file) in the VM folder, you can call something like:

Get-ChildItem vmstores:\vcenter.dom.com@443\myDatacenter\myDStore02\myVM0\*vmdk | ft -a Name,ItemType,Length

From that you should see at least two VMDK files (two per virtual disk on the VM).  That help?

BTW:  those datastore browser paths provided by the VimDatastore PSProvider are case sensitive, if you did not already see.

Reply
0 Kudos