My Apple APFS partition is entirely full, and now I can't delete anything anymore. How do I fix this?

-1

APFS is a copy-on-write filesystem, which means that any modification including deletions require writing new metadata, not just changing existing metadata. The new metadata requires free space. At least on OSX Mojave that means that if there is no free space at all left, you cannot delete anything anymore.

I have no idea how a filesystem with such usability issues can be pushed as default by Apple.

Now my filesystem is full, how do I fix this without reformatting the partition and losing all my data?

JanKanis

Posted 2019-12-30T22:22:16.240

Reputation: 139

Answers

-1

As far as I know there is no option to resolve this within the volume. I have found several suggestions online that say reformatting is the only option. Fortunately that is not always true.

To resolve this, you will need to look at your other volumes and snapshots within the container. Containers and volumes (and other partitions) can be listed from the command line with diskutil list. Free space is shared between all volumes in an APFS container, so if you manage to clear space in another volume you should be able to then remove files again in the first volume. There are a few ways to create more space:

  • Mojave stores its swapfiles and hibernation data in a volume named 'VM'. If your swap usage is currently larger than the default (I am not sure what the default is), a full restart of your system will shrink the 'VM' volume back to its default, giving you some free space to work with. Be sure to delete some files from your full volume to make more space. (Disclaimer: if there is no more-than-default swap space to free, your computer may not be able to boot anymore, at least not into the regular environment. I haven't tried this.)

  • Local Time machine snapshots are stored as APFS snapshots. If you have those, deleting some of them should give you some space. Terminal command tmutil listlocalsnapshots / will list them.

  • If you created additional volumes, you may be able to delete data from those or delete an additional volume. The free space is shared within the container so this will give you some space to work with. However the default is only one main volume and a few system volumes (Preboot, Recovery, VM) that you probably can't just delete, so this won't apply to most users.

  • If there is free space at the end of the container, or another partition you can remove/resize, you may be able to grow the container to create additional space. This also won't apply to regular installations.

  • Maybe it is possible to remove one of the system volumes from within e.g. the recovery environment, but that's just a guess. Maybe they are locked down with system integrity protection that you'd have to disable first. Anyway this is breaking your system in some way. Removing (and maybe recreating) the VM volume might be possible, I don't know if OSX will recreate that when it finds it or files in it are missing.

Unfortunately the above options do not always apply, and you can end up in a situation where (as far as I am aware) reformatting is the only option. I hope Apple will fix this soon.

If somehow creating additional free space in the container is not possible, you may still be able to boot into target disk mode or recovery mode to backup your data. If the main environment is still running you should be able to backup files from there. This is probably a last resort before reformatting your disk. But keeping backups is a good practice anyway of course.

JanKanis

Posted 2019-12-30T22:22:16.240

Reputation: 139

Care to explain why the downvote? – JanKanis – 2020-01-05T16:32:57.627