ZFS FreeBSD-12 zsnap snapshot options

I have a desktop system with multiple zfs file systems. The pool is called zroot. I want to snapshot two of these filesystems and exclude any zfs filesystems that mount below those mount points. I believe that requires -R option to prevent recursive snapshots but I may be mistaken.

The filesystems available are:
Code:
NAME                        USED  AVAIL  REFER  MOUNTPOINT
zroot                       480G   411G    96K  /zroot
zroot/ROOT                  359G   411G    96K  none
zroot/ROOT/default          359G   411G  39.2G 
/zroot/tmp                   743M   411G  3.51M  /tmp
zroot/usr                  46.5G   411G    96K  /usr
zroot/usr/home             45.8G   411G  43.9G  /usr/home
zroot/usr/ports             751M   411G   751M  /usr/ports
zroot/usr/src                96K   411G    96K  /usr/src
zroot/var                  1.48G   411G    96K  /var
zroot/var/audit              96K   411G    96K  /var/audit
zroot/var/crash              96K   411G    96K  /var/crash
zroot/var/log              15.8M   411G  10.8M  /var/log
zroot/var/mail              184K   411G   120K  /var/mail
zroot/var/tmp              1.47G   411G   192M  /var/tmp

What I want backed up using snapshots is /root (the root user home directory) and /usr/home (the rest of the user home directories), and nothing else.

I do not want /var, /var, or the rest of /usr.

My command for this is:
Code:
for FS in zroot zroot/usr/home ; do /usr/local/sbin/zfsnap snapshot -nv -a 48h -s -S -R $FS ; done

When run with the -nv option this shows:

Code:
/sbin/zfs snapshot  zroot@2019-11-26_14.03.09--48h
/sbin/zfs snapshot  zroot/usr/home@2019-11-26_14.03.09--48h

When this is run without the dry run option (-n) there is no snapshot created in /.zfs/snapshot but there is one created in /usr/home/.zfs/snapshot. The only way I am able to get /root in a snapshot is to do a recursive snapshot of the entire zroot pool. Which I wish to avoid because there are directories under/var which frequently have large changes in content. That causes the size of recursive snapshots to expand to the point that the system is hobbled for lack of disk space.

How do I accomplish what I seek to do: short of renaming /root to /root2, creating a filesystem called /root, and copying the contents of /root2 to /root?
 
The -R option creates recursive snapshots, so it appears you don’t want that.

If /root is just a sub directory under /, then you need to snapshot whichever file system is mounted on /. I suspect that will be zroot/ROOT/default. The snapshot would appear under /.zfs/snapshot.

Alternatively you could create a new dataset specifically for the /root folder.
 
Back
Top