Shrink a Windows VM in XenServer

citrixhard driveovfshrinkxenserver

I faced a problem. I deployed a VM by size of 500GB on Citrix XenServer and now I want to shrink it, because I don't have enough space for snapshots. Now I want to perform an export/import to do this. I'm wondering if it's possible to import the OVF or OVA image on a smaller Virtual HD? or HD should be the same size?

Best Answer

In XenServer the process is to use XenConvert. (You convert with a shrinked HDD, and you re-import the image into the XenServer)

Please see that KB. How to Resize a XenServer Virtual Disk

The KB was created in 2014, but in old XenServer that tip worked. The tip state to use XenConvert 2+, but in 2011 it was already released.

KB's text:

To complete the following procedure, you need the access to Access to XenConvert 2.x.

1.Download and install XenConvert on the Windows VM.

2.Attach a secondary disk that is 205 percent times the size of the existing VDI. The secondary drive is to be used as temporary space for XenConvert.

3.Format the secondary disk with an NTFS file system and add a drive letter to the disk.

4.Open XenConvert and click Next.

User-added image

5.Adjust the free space size as the following:

•Example for original size: 14406

User-added image

•Example for New size: 5000

User-added image

Description of the fields in the preceding figures:

•Used Space: The space currently being used in the VDI.

•Free Space: The new size for the VDI. So if you want to make it 10GB, you change the value to 10240 MB.

•Unallocated space: The additional space you give to the VM and that is displayed as unallocated space.

•Capacity: The value in the last row is the VM VDI total size:

User-added image

Proceed with the XenConvert utility to create a disk to import later or to create the new VDI on the XenServer.