My VM has two disks located on Datastore_005 and Datastore_006
The disk located on Datastore_005 is Thin
The disk located on Datastore_006 is EagerZeroedThick
I can convert the VMs disks from thin to thick eager Zeroed by:
move-vm MyVM01 -datastore Datastore_007 -DiskStorageFormat EagerZeroedThick
Is it possible to convert on the disk located on Datastore_005 to Thick Eager Zeroed without moving it to another Datastore while the VM is online ?
I'm afraid so.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, if a number of conditions are met:
In that case, you can use the InflateVirtualDisk method.
$datastoreName = 'Datastore_005'
$vm = Get-VM -Name $vmName
if($vm.PowerState -ne 'PoweredOff'){
Write-Host "The VM needs to be powered off"
}
if(Get-SNapshot -VM $vm){
Write-Host "There may not be snapshots on the VM"
}
$si = Get-View ServiceInstance
$vmdkMgr = Get-View -Id $si.Content.VirtualDiskManager
$dc = Get-Datacenter -VM $vm
Get-HardDisk -VM $vm | where{$_.StorageFormat -eq 'Thin' -and $_.Filename -match $datastoreName} |
ForEach-Object -Process {
Write-Host "Inflating $($_.Name) on $($vm.Name)"
$vmdkMgr.InflateVirtualDisk($_.Filename,$dc.ExtensionData.MoRef)
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc
Yes but the VMs has to remain powered on. (it +1000 VMs and lots of them are in production with no downtime available in normal business hours)
So I guess that I need to move the thin disk to another datastore to be able to do it while its online.
Or migrate the thin disk to a temporary datastore and then move (convert) it back to source datastore.
I'm afraid so.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I guess I should use something like this from one of your other great solutions:
$vmdkMgr.MoveVirtualDisk($srcVMDK,$srcDC.ExtensionData.MoRef,$dstVMDK,$dstDC.ExtensionData.MoRef,$force,$null)
But I'm not sure how to use it ?
Just thought of this, did you already try with Set-Harddisk and the StorageFormat and Datastore parameter?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Can we convert VM's having Thick provisioned to Thin provisioning ? Please let me know if yes what are the possible way to do.
Thanks
vmk
Afaik, that will only work with a Move-Harddisk cmdlet and the StorageFormat parameter.
I don't think there is an option to do this in-place.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you, LucD. We have data store provisioned and we are planning to get rid of thick provisioned disk.
thanks
vmk
Hi All,
Did we get this sorted yet please?
We have Think disk VM's in infra which we need to convert to Thick eager zeroed while doing the SVmotion of the VM's and moving them to a spedified cluster. The Vm's should be powered ON all time. Can this be scripted somhow please. There are lot of VM's and doing this manually will take month's to complete.
Thanks for any assistance anyone could provide.
~Nitin
