Shrinking VM disks in MyCloudSpace
Or why it pays to think about your disk sizes and layout when you build a VM
One fairly regular request that we get is from customer who have moved data off a drive and ask "Is there anyway for me to shrink disks in Mycloudspace?"
The short answer is no, and while that may seem a veiled excuse for us to keep chaging for resources that is not the case.
We are always keen for customers to get the best value for money and reduce unnecessary spend where possible.
The reason in this case is the underlying VMWare platform. ESXi does not allow you to reduce the size of a disk. The official word is:
Note: You cannot shrink virtual disks using vmkfstools in ESXi as the hypervisor is not aware of the file system layout and cannot ensure a safe shrink operation.
If you try and shrink a disk in VMware directly you get:
So where now?
This is where the original disk layout of the VM comes in.
If you create a VM with a single disk (c: on Windows or / on Linux) the that first drive is where the OS and any subsequent data is stored.
Its best to create a OS disk or a reasonable size (~60GB for Windows, Less for Linux) and a second disk to hold your app data (d: drive or whatever). Adding multiple disks doesn't increase the cost, you only pay for disk size.
If you have your data on separate disks then it's a relatively easy to "shrink" your disk.
Just add a new, smaller, disk. Migrate your data, stop services, remount new disk in original location, restart services and delete the bigger disk.
Takes a little bit of planning, but easy enough to do.