I set up an ubuntu 22.04 system recently on my home server. I have selected ZFS as the file system. I will use the ubuntu system for a few tasks which can not be easily done on Windows and I would like to run a small kubernetes installation.
Hence I am wondering which backup strategy would be best. Being unfamiliar with ZFS, I did a small tutorial (https://ubuntu.com/tutorials/using-zfs-snapshots-clones) and googled around. My current best guess would be to periodically run a cron job which sends a full backup of my machine's filesystem to my NAS. My Ubuntu's zpool list shows 2 pools (bpool and rpool).
I can think of 2 scenarios:
- My installation gets messed up, I want to return to an earlier snapshot (i.e. last week)
- The disk of my server dies
I thought that in both cases I could (maybe) do something similar like outlined here: How to properly save and restore encrypted ZFS snapshots for a stock Ubuntu setup? So I would do (periodically, via cron):
zfs snapshot -r rpool@snapshotname
zfs snapshot -r bpool@snapshotname
- send both snapshots over to the nas with
zfs send --replicate --raw rpool@snapshotname > /mnt/nas-mount/ubuntu-snapshots/snapshotname.zstream
andzfs send --replicate --raw bpool@snapshotname > /mnt/nas-mount/ubuntu-snapshots/snapshotname2.zstream
Can I then recover my system in the case of a completely new disk as well by running
zfs receive newrpool < /mnt/nas-mount/ubuntu-snapshots/snapshotname.zstream
- and rollback to the snapshot via
zfs rollback -rR NAME
Or will this only work as long as I want to restore data but the disk is in tact? Is there anything else to consider or a better idea? I do not have 2 systems with ZFS unfortunately.