How to shrink a Windows VM in XenServer
When I was told that you could only grow (not shrink) the storage volume for a running Windows VM in XenCenter, I took that as a challenge. Guess what, there is a way to shrink it! Here is how:
- Use XenCenter to add a new disk to the existing VM, making it the size you want to srink 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.
- 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.
- 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.
- I used version 2.4.1.
- It requires Microsoft .NET v4.0, so you may need to download that from Microsoft and install it before running XenConvert.
- 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:)
- Go have a coffee, or something, and come back later.
- Right Click the new partition and select “Mark Partition As Active”.
- I did this from inside the VM using Start->Shut down.
- 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.
- If it all works the way you want it you can go delete the original drive in XenCenter to reclaim the space.
You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.