ZFS How do I make a backup of the entire ZFS pool (zroot that's created during FreeBSD installation)?

as above

when I mentioned snapshot, I meant all of the pool and not just the individual filesystem created by FreeBSD. So in case I made a mess in various folders, I can just rollback to this snapshot and my FreeBSD instance feels it's newly installed/factory reset.

Thanks

for reference, here are the various filesystems created during Auto-ZFS installation

Code:
root@mydesktop:/home/myuser # zfs list
NAME                 USED  AVAIL  REFER  MOUNTPOINT
zroot                887M  51.0G    96K  /zroot
zroot/ROOT           884M  51.0G    96K  none
zroot/ROOT/default   884M  51.0G   884M  /
zroot/tmp            112K  51.0G   112K  /tmp
zroot/usr            432K  51.0G    96K  /usr
zroot/usr/home       144K  51.0G   144K  /usr/home
zroot/usr/ports       96K  51.0G    96K  /usr/ports
zroot/usr/src         96K  51.0G    96K  /usr/src
zroot/var            724K  51.0G    96K  /var
zroot/var/audit       96K  51.0G    96K  /var/audit
zroot/var/crash       96K  51.0G    96K  /var/crash
zroot/var/log        244K  51.0G   244K  /var/log
zroot/var/mail        96K  51.0G    96K  /var/mail
zroot/var/tmp         96K  51.0G    96K  /var/tmp
 
What about using bectl or beadm (thanks, vermaden!)? Am I missing something in your question.

Here's a quick article by Michael Lucas (who, in my opinion, is a great documenter, even for the stupid like me), on using beadm.

Using bectl is pretty much the same, save that it's a FreeBSD builtin. On rare occasions, it may fail to destroy a snapshot on command, see the thread about it. https://forums.freebsd.org/threads/cannot-destroy-a-boot-environment.73296/.
 
as above

when I mentioned snapshot, I meant all of the pool and not just the individual filesystem created by FreeBSD.
As usual the manual pages as wel as the handbook can provide some help here.

Anyway, ZFS backups only work on a per-filesystem (or "dataset") basis. The # zfs send command can only be applied on a filesystem (or snapshot within that filesystem). So in order to set up a full external backup you'd need a bit of scripting to send every individual filesystem onto a separate host.

Another option is of course a snapshot. Make a named snapshot now (for example "init") and just ignore it. You can make snapshots at once across all filesystems so... that works. Of course the downside to this is that as time goes by that snapshot will also severely grow in size, depending on whatever is changing on that system of course.

Personally I'd apply a combination of both strategies.

(edit)

Almost forgot: making a backup is one thing, restoring it another. You'll have to apply specific parameters to tell ZFS that it should rebuild the whole filesystem (see the zfs receive section in zfs(8)).
 
Back
Top