macOS Filesystem Snapshotting Solutions

Hi all! I’m setting up a little Hackintosh right now, and trying to get it upgraded to the latest macOS as more or less a blank slate.

I’m mostly interested in using it to test compatibility and automation tools, especially of the installers for third-party package managers like Nix, Homebrew, and pkgsrc. For that reason, it would be ideal if I could easily and quickly restore it to a blank slate state, perhaps only on (sub)volumes or datasets or whatever containing the filesystems for a given package managers.

I understand that APFS is a CoW filesystem which supports snapshots, but there are several aspects of the integrated/base implementation which make me think it might not be suitable.

One aspect is that the CLI for managing snapshots kinda sucks, and I don’t know how much of that is determined by the implementation of APFS. They are:

  • the CLI for snapshots is bound up with the CLI for Time Machine, which I don’t care to use or know about
  • APFS (or at least the CLI) doesn’t seem to support named snapshots, so labeling them is impossible (?) and referring to them is a pain
  • filesystem snapshots are purged/garbage collected by some daemon called deleted, and it appears that all snapshots you can create through the CLI are subject to such deletion
  • the Time Machine GUI can suddenly do awful and irrevocable things to your snapshots: ticking and unticking a checkbox for automated backups will silently delete all local APFS snapshots

So I’m wondering if some more experienced macOS users here can tell me:

  1. Are there any decently maintained third-party CLI tools for interacting with APFS that are more powerful than what comes with the base system?

  2. Is there any way to create named snapshots on APFS filesystems?

  3. Are any macOS implementations of more mature CoW (or snapshotting) filesystems (i.e., ZFS, but others are fine if they’re out there) stable enough to use on macOS’ root partition?*

I’m mainly hoping there’s someone here running macOS on OpenZFS (on /) who can tell me what it’s like. :crossed_fingers:

(VMs are annoying to use and their snapshots are relatively slow and inefficient, so please set aside alternative approaches involving VMs in this thread.)

*: I’m okay with shrinking down the stock APFS volume before copying its contents and leaving it in place, so I don’t mind if major OS upgrades break my support for the alternative filesystem (although that is not ideal!). I just don’t want crashes, application incompatibility, or abysmal performance.

1 Like

Spent some time working through the guide today, and found out that the current implementation (OpenZFS on OSX 2.0.1, a brand new port from OpenZFS 2.0, which was just rebased on ZoL) doesn’t yet include the logic for mount_zfs, the command that the macOS mount utility, and maybe other parta of the operating system, uses to mount ZFS as an ‘external’ filesystem.

The lead developer of the port (which aims to be upstreamed by the time OpenZFS 3.0 comes out!) has indicated that this means booting to a ZFS root partition likely won’t work on the new port until the next point release, 2.0.2.

There may also be problems for releases of macOS newer than 10.15.5, for unrelated reasons, when it comes to booting to ZFS on /.

Once 2.0.2 comes out, I’ll come back here to post about my results with a supported release of macOS Catalina.