How to shrink a Windows VM in XenServer

Apparently shrinking a Windows VM (actually any kind of VM) cannot be done with XenServer and XenCenter. You need to create an image of the original volume to a smaller virtual disk in order to do that.

On top of that, the tool that used to work fine for this, Citrix XenConvert, has been deprecated by Citrix and is no longer available for download.

And just to make matters worse, this answer on ServerFault links to an article that is no longer available (or did, until I edited it). Fortunately it’s still in the WaybackMachine

Now, where do we get XenConvert? It’s available for download here in various versions. I took version 2.5. and followed the instructions in the above mentioned article. You might want to virus check the installer before running it.

  1. Create a new virtual disk with the desired size.
  2. Attach it to your VM.
  3. Start the VM.
  4. Optionally, shrink the source drive (partition) from within the virtual machine (Windows 7+ comes with the tools for that).
  5. Format the newly created virtual disk.
  6. Install XenConvert
  7. Start XenConvert, select From: Volume and To: Volume (That’s not the default.)
  8. Select source and destination volumes.
  9. Run the conversion (which takes forever).
  10. Activate the new partition in the Disk Manager (if you forget this, you won’t be able to boot from it).
  11. Shutdown the VM.
  12. Detach the original virtual disk.
  13. Boot the VM (from the new virtual disk).

If everything works, you can now delete the original virtual disk.