Shrinking XenServer VDI’s

This one is more of a note to myself…

1. With a third party utility shrink the windows partiton to the desired size.
2. Shut down the virtual machine
3. Next step is the use of the "lvreduce" command to get back the extra space. Make sure you leave a little room for overhead just in case. I usually go 1GB bigger than the partition size then resize again to fill the extra gig:

· in the shell of the host console type "lvm"

· then "lvdisplay" to display all the informations of your logical volumes. Find your logical volume, select and copy the LV Name associated

· then "lvreduce <LVName> –size 16G " (replace LV Name by the one you copied, just right click and paste. replace 16G with desired size)

4. Power on your VM and make sure windows starts correctly, verify disk partitions and disk sizes in disk management.
5. Run the command “xe-toolstack-restart”. I had to wait a few hours for the space to get freed up after running this command. If you reboot the host server it will be immediate and negates the need to run this command.