Hi all,
I will do a backup of a test vm to a nas mount (datastore). The state of the vm is "off" and the disk provisioning type is Thin.
I found a nice script:
$ds1 = Get-Datastore DatastoreName
+ $ds2 = Get-Datastore NASBOXDatastoreName+
New-PSDrive -Location $ds1 -Name source -PSProvider VimDatastore -Root '\'
+ New-PSDrive -Name dest -PSProvider ViMdatastore -Root '\' -location $ds2+
Copy-DatastoreItem source:\VMNameToCopy\* -Destination dest:\VMNameToCopyBackup\ -Recurse -Force
That works perfect, but my problem is that the copied vmdk file type is thick. How can i change that?
Thanks in advance
AFAIK thin provisioning works only on VMFS, i.e. iSCSI / FC.
---
MCSA, MCTS Hyper-V, VCP 3/4, VMware vExpert
When I do a "Clone" (with the GUI) of the vm, then Thin provisioning works on this NAS Datastore.
You can use the Thin format on NAS-based datastores.
Why don't you use the Set-HardDisk cmdlet with the -Datastore parameter ? That allows you to copy a specific hard disk of a guest to a different datastore.
The 'clone' from the vSphere Client is based on the CloneVM_Task method. With that method you can specify the storage format.
In powerCLI you can do the 'cloning' with the New-VM cmdlet.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference