PowerCLI Change VM disk from thin to LazyZero or EagerZero Thick

I had a project where the customer wanted everything converted from thin to thick lazyZero.  Of course I wanted to do this automatically.  Here are a few things to know:

  • Changing the disk type requires you move the disk between luns so it helps to have a go between
  • If you convert EagerZero into thin it will still take up the whole disk

The name of the disk types in powerCLi are different

  • Thin = thin provisioned
  • Thick = lazy zero thick
  • EagerZeroedThick = Eager Zeroed Thick

So here are the commands in powerCli

Move-VM $VM -Datastore $destDS -DiskStorageFormat $disktype

Just replace the following items

  • $VM with name of virtual machine
  • $destDS with destination datastore name
  • $disktype with disk type

 

So the whole process for hundreds of VM’s would be this

  1. Check destination disk format fits what you want to change from
  2. Check for snapshots
  3. Check for RDM
  4. Move disk to temp storage lun and change format
  5. Move disk back to original datastore and keep changed format
  6. Rinse and repeat

Enjoy.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.