Login
You're viewing the functional.cafe public feed.
  • Nov 7, 2026, 2:42 PM

    Please share your 'clever' use of zfs snapshots / filesystems for stuff most people don't use.

    I'll start with FreshPorts.

    The HTML cache is stored on disk, in plain text files. If a port needs to be refreshed, those files are removed. All the files for one port are in a directory, matching the ports tree layout. Want to refresh sysutils/anvil? run:

    rm ~freshports/cache/ports/sysutils/anvil

    If a major change has occurred, and all ports need to be refreshed:

    zfs rollback freshports/cache/ports@empty

    I also have zfs filesystems containing a single 4K file.

    What's your story?

    #ZFS

    💬 2🔄 2⭐ 0

Replies

  • Nov 7, 2026, 3:31 PM

    @dvl

    hah, after your first paragraph, my answer was going to be "snapshotting an empty directory that needs to be cleared occasionally, so it's faster to do a rollback", only to see that as your subsequent example 😆

    💬 0🔄 0⭐ 0
  • Nov 7, 2026, 5:20 PM

    @dvl I use them in jail provisioning:

    $ zfs list -t snapshot zroot/jails/templates/15.1-RELEASE-amd64-amd64
    NAME USED AVAIL REFER MOUNTPOINT
    zroot/jails/templates/15.1-RELEASE-amd64-amd64@unpacked 120K - 350M -
    zroot/jails/templates/15.1-RELEASE-amd64-amd64@verified 132K - 350M -
    zroot/jails/templates/15.1-RELEASE-amd64-amd64@tweaked 0B - 611M -
    zroot/jails/templates/15.1-RELEASE-amd64-amd64@ready 0B - 611M -

    but the trick is that the ansible scripts check for the *directory* /jails/templates/15.1-RELEASE-amd64-amd64/.zfs/snapshot/ready/ to decide if they can skip a phase.

    It makes the provisioning a lot faster, as mostly there's no work to be done, and avoids needing to shell out to a zfs command each time.

    To patch the jails, I just rollback or destroy the templates, re-run ansible and everything is populated.

    💬 1🔄 0⭐ 0
  • Nov 9, 2026, 9:17 PM

    @dch I think I get it.

    You never update jails, they get redeployed. I don't have that setup. I do have ansible playbooks for some thing, but not a set-up-from-nothing script.

    💬 1🔄 0⭐ 0
  • Nov 9, 2026, 9:29 PM

    @dvl yea this. Once I learned how to split off mutable / backup-required data from pkg / os files, this got a lot simpler. With container this is getting even easier.

    💬 0🔄 0⭐ 0