I'm running VMware Workstation 14 Pro on Windows 10 64-bit with Linux Mint 20.1 xfce as a guest with "growable" disk. Internally, the guest's disk is using MBR scheme with a FAT boot partition followed by ext4 root and home partitions. Until recently, all was working fine, but suddenly (I guess as the guest's disk usage increased), I am unable to suspend the VM, VMware gives me "There is not enough disk space to save the virtual machine state" error. The VM is configured to use 32GB of RAM and the .vmdk file takes 436GB out of the 463GB available on the physical disk (only the VM files are on the disk, nothing else). If I reduce the RAM used by the VM, I'm able to suspend again, but that is not a solution for me. What I need is to limit the virtual disk size to a value that allows to store the guest's state on suspend on the same disk.
There is enough unused space on the guest's disk, I just need to be able to shrink the virtual disk. I tried to follow various tutorials on shrinking the guest's virtual disk, however none has worked. In the VM settings, clicking on the "Compact" button shows "The disk was successfully compacted.", but the virtual disk size was not changed. Clicking on the "Defragment" button gives me "There is not enough space on the file system for the selected operation." error.
Inside the guest, I have shrinked the last partition with GParted, used the remaining space to create a new "dummy" ext4 partition and filled it with zeroes with dd (I also tried the alternative "vmware-toolbox-cmd disk wipe"). Then I tried "vmware-toolbox-cmd shrink" on that partition - again, I get "There is not enough space on the file system for the selected operation." error (although I run this command in the guest's shell, I get the error in the host's environment). "shrinkonly" gives the same error. I also tried to defragment ("-d" switch) and compact ("-k" switch) with vmware-vdiskmanager.exe on the host, getting "An error occurred while writing a file; the disk is full. Data has not been saved. Free some disk space and try again (0x8).".
So I'm in the situation when I have enough free space on the virtual disk, but I'm unable to shrink it. I guess the issue is that VMware cannot see that there is actually free space on the guest's virtual disk? Can you please advise how to successfully shrink the virtual disk and limit it's size, so I don't run into the same issue again? Can you confirm that it is possible for me to do this with my setup (i.e. multiple ext4 partitions on the virtual disk)?
Normally I'd default to snapshots being a potential issue as you can't usually reclaim much space with even one....your situation seems to involve an actual shortage of HDD space on the host though so my first suggestion would instead be to COPY or Fully Clone the entire VM to a larger drive and open that copy in Workstation and do some cleanup INSIDE the VM.
After freeing up space inside (Which you seem to think it already has quite a bit of so maybe you can skip that part of the cleanup phase) you can then try compacting and adjusting it from there via Workstation as I suspect this is just a situation where there actually isn't enough room left on that first HDD (where it's currently stored) for Workstation to do the requested work. Once it's sufficiently trimmed (and tested) you could then move the copy back to the initial location?
As for limiting an existing VMs size, I can't say I know of a way to lower its limits springs to mind, only expanding it...sorry!
