What should we know about APFS special files?
eclecticlight.co
eclecticlight.co
Here I just see great size optimizations that I’d expect from a modern OS, which sometimes can be more complex than what one saw in the 90s, and can’t be expected to make sense without being a magician.
Does it make sense to see a file on my computer when it’s really just stored on the cloud? How can my 64gb phone have a 500gb photo library? I see no difference here, but this has been common for the past decade.
As it says in the post: "Magic works best when the spectator either knows nothing about the sleight of hand involved, or is another skilled magician". APFS in the Finder makes both impossible.
Special file types have been around in other file systems for a long time now.
For instance, Hard Links have been a thing on NTFS disks since the first version of Windows NT.
Deleting a hard link for a file on on an NTFS disk doesn't result in freeing any space, until you delete all the hard links as well as the original file.
This is a feature of APFS that Finder can't do much about it: local backups via the APFS snapshotting. APFS maintains a number of local backups for a period of time in a preparation (or, rather, in a hope) to permanently transfer the backups to an external Time Machine, after which the local backups are purged. If there is no external Time Machine set up, the backups will be purged after N days or under the disk pressure (free space is needed urgently).
btrfs in Linux creates file system snapshots in a similar way.
It is possible to entirely disable the APFS snapshots via «tmutil disable», but it will become impossible to restore deleted files, which may or may not be important for some.
The snapshots can also be manually deleted at any time by running a one-liner:
for i in `sudo tmutil listlocalsnapshotdates | grep '^20[0-9][0-9]'`; do sudo tmutil deletelocalsnapshots $i && echo $i deleted; done
I have a 512 GB SSD and handle large files often on the go. I've had snapshots taking up 100+ GB with no explanation on my Macbook, just missing space.
Only figured this out when i googled support forums, used 3 party software or went into the terminal.
Apple and their "Magick", confuses regular users and wastes my time.
Volume snapshotting via checkpointing along with the copy-on-write has been used in UNIX file systems for a very long time and successfully, starting from Veritas VxFS. It is also used in ZFS, in btrfs, bcachefs et al and in some form in the log-structured file systems.
If the default volume snapshot reclamation policy does not work for you, «tmutil» provides a number of controls to fine-tune the behaviour:
1. Disable the snapshotting in perpetuity via «tmutil disable».
2. Exclude select directories from snaphots via «tmutil addexclusion directory1 directory2 directory3»
3. Adjust the quota on how much of the disk space to allot to the snapshosts/backups via «tmutil setquota»
All of the above are one-off commands that, once run, have a permanent to a long lasting effect.
If you want a first-party GUI you can also use Disk Utility: https://support.apple.com/guide/disk-utility/view-apfs-snaps...
I like to work with git worktrees, and I work on an app that has a large (2 gb) node_modules directory.
Previously, every time I made a worktree, I had to `npm install` to get a fresh node_modules, or copy the full directory, which was slow.
$ time /bin/cp -r node_modules /tmp/node_modules
/bin/cp -r node_modules /tmp/node_modules 1.98s user 58.26s system 63% cpu 1:34.17 total
The -c option to /bin/cp on a mac is "copy files using clonefile(2)", making clones instead of full copies. It's still not super fast, but almost a minute less of waiting for the copy is a nice improvement: $ time /bin/cp -rc node_modules /tmp/node_modules_cloned
/bin/cp -rc node_modules /tmp/node_modules_cloned 0.43s user 29.85s system 79% cpu 38.211 total
The one downside is that GNU has an incompatible option for creating clones (`--reflink`), leading to this very ugly conditional:https://github.com/llimllib/personal_code/blob/0e1034f13b31f...
Surprised to see this confusing statement in an article about understanding file sizes. The difference is due to base-2 vs. base-10 units: 100 GiB = 107.4 GB
In context The 107 GB and 18.47 GB are being contrasted, not 100 GB and 107 GB.
I recently couldn't get Photos to import photos from my iPhone anymore. I didn't get any error message or anything. I would click on Import, it would (seemingly) start and then just stop the import without anything actually imported.
Then I noticed that I was very short on disk space, so I deleted some stuff. Which of course didn't immediately free up the space due to TM snapshots. I didn't want to mess with Time Machine, so I just waited 24 hours, and lo and behold, there was more free space and import in Photos was working again.
This is with an older macOS version, so maybe this has been fixed in the meantime.
But it's not really what I would expect from "it just works".
There are small enclosure for mSATA or NVME 2230 SSD, with the form factor of a flash drive, and the speed and reliability of an SSD.
Once it was joked about "Windows file transfer visits some friends" and now we have "Finder copies some files"
I hope Apple rights this course to make the UX consistent as it was in the pre-APFS days.