Apple - Disk full; Terminal in Recovery mode won’t delete files; boot kernel panics
In spite this post is old, I decided to leave my solution here to help community with one more approach.
note: I wrote a medium with more description.
In my case, I din't have that extra partition available so, in recovery mode:
Run the terminal
run
diskutil list
Find the identifier of "VM" volume. In the case of the previous image is "disk1s5". You'll probably have "disk2s4"
delete the volume VM:
diskutil apfs deleteVolume disk1s5
(replace the disk1s5 for your VM identifier)
- You are now able to remove files on "/Volumes/Macintosh HD"
I hope it helps someone.
I am so lucky. Posting this to hopefully help others.
I had partitioned my APFS volume, and was able to delete the non-boot partition. This gave the boot volume enough space, and I'm back up. I'll clean up the drive and restore that volume.
I found a post on a ZFS forum that suggested that these new filesystems require some disk space to perform any disk operation. If you have 0% left, you're out of luck.
All other tricks to remove the file, to overwrite it with null data, failed.
dd if=/dev/null of=/path/to/large/file
failed.
true |> /path/to/large/file
(or something similar, I forget the exact command) failed.
Everything failed, except booting in to Recovery mode and, without mounting any drives first, deleting the extra APFS partition.
Lesson: keep a ~100MB dummy partition (or just quota your main drive so it can't take up 100% of the physical disk) as your get-out-of-jail card.
Edit: I actually mean that I had multiple APFS volumes on my boot partition, and that I deleted one of those volumes. Old language dies hard.