Resizing PVHVM flavours Down via API

So, in the case you have a cloud-server, such as a Rackspace standard flavour instance, you might want to resize down.

The only problem is that when doing this it can result in the MBR being lost. Check out this great article from Jake Coe, explaining how it can be achieved.

https://community.rackspace.com/products/f/25/t/4716?_ga=1.244296325.1822315901.1458550977

Because of the sizes of larger vhds it will not let you downsizes these devices within the control panel. There may be a way to downsize them IF you are not using more then the required space on the server however there are some risks involved and once the downsize is completed there will be a manual fixed needed for the servers to get them to boot.

I would highly suggest that the following be attempted on a non production server as dataloss could happen.

Create an image of existing server you want to downsize.

Once the image is completed we can modify the min disk and ram to that of the smaller size needed.

On the new server once built to the larger size you will 1st need to write all zeros to empty space.

cat /dev/zero > /zero; rm -f /zero

Once this is done you will then downsize the server to the desired size.

Once the downsize is completed if this is a pvhvm instance the mbr will be gone and grub will need to be reinstalled