So in the good old days before APFS I could shrink Mac virtually disks with this script inside the VM:
#!/bin/sh
sudo diskutil secureErase freespace 0 Macintosh\ HD
sudo /Library/Application\ Support/VMware\ Tools/vmware-tools-cli disk shrinkonly
sudo halt
...but now with APFS I have to write 0 to freespace then shut the VM down and do the shrink from the host terminal. Is vmware-tools-cli going to gain the ability to shrink APFS?
....and in Catalina Beta the freespace 0 command no longer works?
You need to check into snapshots or disable them.
Definitely disable snapshots.
But, and more importantly, I'm thinking that secureerase freespace is depreciated for APFS drives. Even on my host machine, when erasing an external drive, file still show up in recovery software.
The VM does not have any snapshots.
No it's not.. you can still secureerase freespace on APFS drives.. i have done it several times from the on my Mac running Mojave from Terminal:-
(Macbook Air 256GiG SSD). I guess this is the only way since Mac OS guest "Clean up after shutting down virtual machine" only deletes snapshots for MacOS VM's.
I guess you can always create AppleScript, then double click to run.
I think they are talking about apfs snapshots..
and it looks like that you cannot disable it anymore in 10.13 and higher.
How to disable Local Snapshots - Apple Community
But you should still be able to remove local snapshots that have been made.
re. the original question.
Perhaps this thread helps:
--
Wil
I can do it in Mojave. I am seeing I cannot do it in Catalina.
I had read that thread and have been using its correct answer to do my Mojave VMs.
Yep, I've run that command many times. Then I've run data recovery software and there's still many files available for recovery, so it's definitely not operating the same on an APFS SSD as it did on an HPFS+ SSD or metal disk.
I am seeing this is quite complicated. In Catalina there are "Macintosh HD" and "Macintosh HD - Data" APFS volumes that are dynamically expanding and contracting in the existing free space of the disk. The partition covers the whole disk. If you have not been here before, Macintosh HD contains the OS, and Macintosh HD - Data contains home folders.
Arguably shrinks could be easier if the VMware utility understood the new scheme and shrunk away the free space? Maybe even automatic after shut down like the Windows VMs have? Otherwise how would one get into that free space to zero it if the partition already covers it? Could the current VMware utility even see that?
In Mojave it is still a single APFS Volume and the old ways thus work.
Hello everybody,
did anybody figure out how to shrink Catalina VM? No luck for me... but after the VM upgraded from 10.15 to 10.15.1 it grew a lot so it would be great if she can lose some fat.
This is what I did:
Clone to a new vmdk using CCC, it will shrink from 25GB to 15GB for a clean installed Catalina OS
This is what I did - essentially going back in the early Linux days 😕
- within the VM create a "zero" file in your home folder:
dd if=/dev/zero of=/Users/alessandro/zero.bin bs=1m
- after the dd completed (you receive a warning that disk is running out of space), delete the zero.bin file
rm /Users/alessandro/zero.bin
- shut down the VM and shrink the VMDK:
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -k <VMDK_DISK>
You know, that's brilliant. I use that to migrate physical to virtual, but didn't even think about it for shrinking.
Can you explain how you did this using CCC? CCC support looked at this thread and they don't how you would have done this? Thanks!
(Sorry I did not see your reply the first time. I will see if I can reproduce this over the weekend.)
This is solved in Shrink an APFS virtual disk
Moderator: Comments posted by another user on this thread related to running MacOS on VMware Workstation have been deleted, running MacOS on non-Apple hardware (such as a Windows system) is a violation of the Apple EULA.