I have a QNap NAS with a virtual Windows Server 2012 R2 Essentials on it. I use this virtual machine only as a backup. Recently I had a need to shrink, or compact, the virtual hard drive image file on it. I found this board post that described a way to do this. But it seemed overly complicated. And for me it would require a hard drive larger than 2 TB to do it. The only hard drive I had that large was in the NAS itself. So I needed a better way. This is the steps I used for my QNap virtual machine, which is based QEMU. The steps should work with any virtual machine, including Microsoft Hyper-V, Oracle VirtualBox, and Synology’s virtual machine. These steps should only be used if there is no other easy way to shrink the virtual hard drive image.

Continue reading