1. 25
  1.  

  2. 8

    When I first learned about ZFS snapshots, it really bugged me that I can’t atomically snapshot a set of filesystems and have to do it one at a time (unless they are all children of a single parent). I recently learned that this is purely a limitation of the userspace tools. The underlying ioctl takes an nvlist of snapshots and will atomically create them all at once. I have no idea why this wasn’t exposed in the tooling. The advice on FreeBSD is to have everything in /usr/local as a single ZFS dataset for exactly this reason: you want to atomically snapshot it before and after upgrades.

    1. 1

      Would a recursive snapshot followed by a delete of the unwanted snapshots do the same?

    2. 3

      Snapshots complement a backup strategy

      Can’t the backup strategy itself be based on snapshots?

      1. 5

        It can! I for one have been sending snapshots to data tapes for a little while.

        However snapshots without any extra actions are only more live backups. They can be lost to the same theft, failure, fire, damage, malware, or other calamities that affect the main storage. Remember that RAID is not backups: you need to protect against the events that may befall your actual storage pool.

        Lose enough disks in a vdev, or have a sysadmin at 2 AM dd(1) the wrong device, or have a flood, and all your snapshots are also lost.

        But when no calamity arises, it’s much nicer to restore from a snapshot than from an offline copy of that snapshot. Just the other day I rolled back a bad update with a snapshot, but I knew I could go to my offline media if I had to.

        1. 3

          Think of snapshots as being similar to an rsync’able copy of the filesystem in question: you have to put it somewhere beyond reach of danger - preferably someplace with a lot of bandwidth and storage but not in the same earthquake zone and power grid and definitely not mountable.

          There’s a nice set of scripts from mercenary_sysadmin called sanoid and syncoid; sanoid schedules snapshots for you in a nicely policy-driven way, and syncoid uses ZFS send to get the snapshots off of your zpool and over somewhere else.