Skip to content

How to shrink a Windows VM in XenServer

You can always grow the storage volume for a running Windows VM in XenCenter, but also there is a way to shrink it. Here is how to do it:

  1. Within XenCenter add a new disk to the existing VM, making it the size you want to shrink the current server to.
    • Select the VM from the list on the right, click Storage.
    • Click “Add…” and create the new volume the size you want it.
  2. Login into the VM, (Console tab in XenCenter also useful when you can’t do RDP) and start ‘Disk Management’ and Initialize the new disk.
    • You can find it in Start->Administrative Tools->Computer Management.
    • Click on the new disk. Mine showed up as “Disk 1, Unknown… Not Initialized”.
    • If you click on the words “Not Initialized” it will be selected.
    • Next select Action->All Tasks->Initialize Disk. Select MBR and OK.
  3. Format a new partition on your new volume (you might be able to skip this step, did not try).
    • Right click on the black “Unallocated” partition.
    • Select “New Simple Volume”.
    • Click Next twice, the size will be defaulted to the full disk, and specify a new drive letter.
    • In my example, I use E:\.
    • Format as NTFS using Quick Format, and click Finish.
    • Once you see formatting finish, and the new partition turns blue and is marked “Healthy” (Primary Partition). Proceed to the next step.
  4. Download and run XenConvert inside VM.
    • Version 2.5 x64.
    • It requires Microsoft .NET v4.0, so you may need to download that from Microsoft and install it before running XenConvert.
  5. Start XenConvert and select From: Volume and To: Volume.
    • Set the Source Volume to your boot drive (C:).
    • Set the Destination Volume to your new drive (E:).
    • Say “Yes” to the warning about losing free space.
    • Click Convert, and accept the warning about erasing data on your Destination volume (E:)
    • Please wait, do something else, and come back later.
  6. When XenConvert is finished, use “Disk Management” again in the VM to activate the new partition.
    • Right Click the new partition and select “Mark Partition As Active”.
  7. Shut down the VM.
    • Within VM using Start->Shut down.
  8. Now re-order the drives on the VM so the new drive is in position 0.
    • In XenCenter, select the VM, and select the Storage tab.
    • Detach the original drive by selecting it and clicking the “Detach” button.
    • Select the new drive, and click Properties, and set the Position to 0.
  9. Now you can boot the VM and voila! It’s now srunken to the size you wanted.
    • If it all works the way you want it you can go delete the original drive in XenCenter to reclaim the space.

You may also like...