VMware Cloud Community
vohuythao
Enthusiast
Enthusiast

[Help] Convert disk from thin provisioning to thick lazy zeroed

Hi guys,

I want to convert VMs disk from thin provisioning to thick lazy zeroed

Is there any PowerCLi command to do that?

Btw, if we convert disk from thin to thick, the data on vmdk file can be lost or not?

Thank you for your kindly answer

Best regards

Thao Vo

5 Replies
LucD
Leadership
Leadership

You can use the Set-Harddisk cmdlet with the StorageFormat parameter, but only when combined with the Datastore parameter.

In other words when you are doing an svMotion.

Not sure what you mean with "... date on the vmdk file can be lost".

Is that based on experience, or do you have a reference where this stated ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

vohuythao
Enthusiast
Enthusiast

Thanks LucD,

So I only convert from thin to thick lazy zeroed when I use vMotion, mean move VMs to another datastore and choose the storage format?

Is there a way to keep the VMs in same old datastore?

Any risk in the converting? I mean can the data in this disk be lost after convert?

Thank you very much

0 Kudos
LucD
Leadership
Leadership

You can change the format while staying on the same datastore, but:

  • not with the Set-Harddisk nor Move-VM cmdlets. You will have to call a vSphere API method
  • you will need to rename the the VM's folder (you can rename it back to the original, but that requires a 2nd in-place move)

I never experienced data loss while doing a svMotion.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vohuythao
Enthusiast
Enthusiast

Thanks LucD,

You can change the format while staying on the same datastore, but:

  • not with the Set-Harddisk nor Move-VM cmdlets. You will have to call a vSphere API method
  • you will need to rename the the VM's folder (you can rename it back to the original, but that requires a 2nd in-place move)

=> seem it's complicated.

I found one way to convert from thin to thick, that is used Set-HardDisk with -Inflate

but it only convert to EagerZero

Between Lazy and Eager Zero, which one you prefer ? Sir LucD? :smileygrin:

Thank you for your kindly help

0 Kudos
vohuythao
Enthusiast
Enthusiast

I found a way to do that

Convert disk format from thin to thick provisioning lazy zeroed

  1. Identify VMDK file that needs conversion.
  2. Use vmkfstools to rename VMDK file to another temporary VMDK file.
    # vmkfstools -E currentName.vmdk newName.vmdk
  3. Use vmkfstools to clone temporary VMDK file to correct / expected VMDK file.
    # vmkfstools -i newName.vmdk -d zeroedthick currentName.vmdk
    This steps actually converts HDD's disk format.
  4. Reload VM.

        # vim-cmd vmsvc/reload vm_id

  1. (Optional) We can remove temporary VMDK files as they are redundant now:
    - newName.vmdk
    - newName-flat.vmdk