VMware Cloud Community
mldmld
Enthusiast
Enthusiast

Copy-DatastoreItem slower than vCenter copy to datastore

Hi all,

I'm automating windows installation using WinPE images and unattended installations.

Here is my configuration

- VC is the vcenter server running vCenter 5.0 build 623673

- NAS is the NAS server (FAS 3020) used as an NFS datastore

- Tech is the server which build WinPE images and unattended files. The iso images are written on C: drive. The Powercli 5.1 U2 is installed build 1012425.

- VC mount the c$ drive of Tech to access iso generated by Tech server.

After generating a WinPE image.If I use vCenter server to upload a WinPE image (around 260 Mo), from C$ of Tech to the NFS datastore,  it takes seconds to copy it.

To do it, I select an ESXi 5.0 build 623860 in VC, then the nfsdatastore, then I browse it, then upload the iso.

If I use a Copy-DatasotreItem command from Tech Server, after connecting to VC, the copy takes around 5 minutes

So in the first method, VC access by SMB to the Tech server disk and copy the data to the datastore through the ESXi I selected

In the second method, Tech connect to VC and without selecting a ESX in the code, copy the data to the datastore

Any idea to make the transfer faster ?

Thank you

Best regards

MLD

Here is the code :

Param(

  [string]$vCenter,

    [string]$UserID,

  [string]$Password,

  [string]$SrvName

)

$IsoDatastore = "nfs99"

Add-PSSnapin VMware.VimAutomation.Core

Connect-VIServer $vCenter -Protocol https -User $UserID -Password $Password

write-host "Copy Iso boot image of $SrvName to Datastore $IsoDatastore"

$IsoDatastoreObj = Get-Datastore $IsoDatastore

New-PSDrive -Location $IsoDatastoreObj -Name dsIso -PSProvider VimDatastore -Root "\"

# Set-Location dsIso:\

Copy-DatastoreItem -Item "c:\Distribution\temp\winpe_x64_$SrvName.iso" -Destination "dsIso:\Windows\winpe_64_$SrvName.iso" -Force

Reply
0 Kudos
4 Replies
Grzesiekk
Expert
Expert

Hi,

do you have the same transfer if you are doing the copy using winscp for example ? If it's faster you can make a copy operation using wiscp via console

http://winscp.net/eng/docs/scripting

Greg

--- @blog https://grzegorzkulikowski.info
Reply
0 Kudos
mldmld
Enthusiast
Enthusiast

Hi,

Thank you for your suggestion, but I would like to limit the number of software or library used.

Reply
0 Kudos
EKardinal
Enthusiast
Enthusiast

The key difference between the two methods seems to be the protocol used for transport.

When you browse the datastore through the vSphere Client, it uses NFC - TCP 902 to connect directly to the esx host. All communication is between the client and the host.

If you check the value returned by (Get-Datastore "nfs99").DatastoreBrowserPath or (Get-PSDrive "dsIso").Root, which is also used by the Copy-DatastoreItem cmdlet as target, you'll see something like vmstores:\vCenter.domain.com@443\Datacenter\Datastore.

I assume, the PowerCLI is using a tunnel through the vCenter on port TCP 443, of course encrypted with ssl. This results in the slow download/upload speed.

Update: Found someone, who explains the way the data takes.

Copy-DatastoreItem - Understanding the Traffic Flow | Technodrone

A workaround could be to connect directly to the esx host, maybe via ssh, and copy the file to /vmfs/volumes/nfs99/winpe_x64_$SrvName.iso

Regards

Emanuel

mldmld
Enthusiast
Enthusiast

Hi

Thank you for your suggestion.

Through vCenter, the download of 260 MB takes 5 minutes 23 seconds.

Trough an ESXi, the download of 260 MB takes 30 seconds

But the ESXi is a SPOF while vCenter is more available thanks to HA.

I will try to copy the iso directly to the filer instead using powercli.

Thank you

Reply
0 Kudos