Can't delete files from APFS volume -- no space left on device [closed]
My Late 2012 iMac's APFS Fusion Drive is full (53 KB free) and caused the system to freeze. I've rebooted into Recovery Mode but I cannot remove any files: rm XXX: no space left on device
. fsck_apfs
reports no problems. I found some suggestion somewhere to remove the APFS Volume named 'VM', but after removing this volume the error remains. After installing macOS on an external disk I tried removing the snapshots, but that resulted in an error. After restarting the snapshots are no longer listed.
The APFS container is the default setup per Catalina on a Fusion drive. There are 2 physical store disks and 5 volumes (Data, Preboot, Recovery, VM & System).
I don't want to reinstall macOS. How can I free up some space such that macOS can boot?
APFS is a CoW (Copy on Write) filesystem therefore anything (includes deleting files) requires writable disk space to perform those actions (refer to this post).
In your case, if removing VM doesn't help (because VM is dynamically-sized, and may happen to have a size of 0 when you attempted to remove it, therefore gave you no extra space), try:
- Get Recovery volume's (where recoveryOS lives in) identifier with
diskutil list
. - Then use
diskutil apfs deleteVolume IDENTIFIER
This should give you some space to delete files. Clean up immediately.
This will also ruin your recoveryOS, to restore recoveryOS installation, just:
Download latest macOS update at https://support.apple.com/downloads/macos and install it. Supplemental updates and security updates are all good.
EDIT: If you're on Big Sur (latest at the time of posting), use Mac App Store to download a full image (I know it's big, but you have to) at: itms-apps://apps.apple.com/us/app/macos-big-sur/id1526878132
(this is the URL scheme for Mac App Store, paste it in any browser)