VMware Cloud Community
Leffingwell
Contributor
Contributor

Move-VM question (thick to thin)

Hey All,

We've got a few VM's that are thick provisioned and want to script making them thin.  We know from experience that using the vSphere GUI if we execute the following we can achieve this without a big headache:

  1. Power off the virtual machine.
  2. Right-click the virtual machine, and click Migrate.
  3. Click Change datastore.
  4. Click Next, and select a datastore that is not the same as the current datastore.
  5. From the dropdown, select the Thin Provision virtual disk format.
  6. Click Next, then Finish.

I know of the Move-VM cmdlet, and I see there is a Datastore parameter we can specify  the new store.  From the GUI we'd have the option to select thin, but I'm not sure how this will translate over from the CLI end.  Any thoughts??

Kindest Regards,

ALAN

Reply
0 Kudos
5 Replies
RvdNieuwendijk
Leadership
Leadership

You can convert a vm from thick to thin with:

Get-VM MyVM | Move-VM -Datastore MyDatastore -DiskStorageFormat Thin

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
gotts
Enthusiast
Enthusiast

I beleive you can accomplish that using this command:

Get-Datastore "CurrentDatastoreName" | Get-VM | Move-VM -DiskStorageFormat Thin -Datastore "NewDatastoreName" –RunAsync

H/t to Alan at http://www.virtu-al.net/2011/09/14/quick-and-simple-storage-vmotion-scripts/ .

Reply
0 Kudos
Leffingwell
Contributor
Contributor

Hey All,

Thanks for the quick response I was hoping it would be simple like that.  Out of curiosity why in the standard doc's do I not see the -DeskStorageFormat parameter?? Is it a common parameter??

Kindest Regards,

ALAN

Reply
0 Kudos
LucD
Leadership
Leadership

Perhaps you are using an older PowerCLI version where this parameter didn't exist yet ?

Use the online reference, see Move-VM


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

Reply
0 Kudos
markdjones82
Expert
Expert

Alan,

  Be sure to reference the latest documentation for the version you are running of Powercli.  They add new features to the commandlets with each realease.

Powercli 5.1 Release 2 was just released yesterday.

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
Reply
0 Kudos