First off, ZFS snapshots are your friend. It's very easy to create a
cron job script that'll snapshot everything daily (or whatever) and
rotate them. This allows you to roll back everything, individual
datasets or just have a look at older files.
Here's a little script I run in a cronjob called "snapshot7days"
-------------------------
#!/bin/sh
for ds in $@
do
zfs destroy -r ${ds}@7daysago
zfs rename -r ${ds}@6daysago @7daysago
zfs rename -r ${ds}@5daysago @6daysago
zfs rename -r ${ds}@4daysago @5daysago
zfs rename -r ${ds}@3daysago @4daysago
zfs rename -r ${ds}@2daysago @3daysago
zfs rename -r ${ds}@yesterday @2daysago
zfs rename -r ${ds}@today @yesterday
zfs snapshot -r ${ds}@today
done
-------------------------
Not exactly complicated.
You run it by passing the datasets you want a snapshot of - e.g.
"snapshot7days zr/jail/webserver zr/jail/dbserver ..."
The next fun thing is dataset replication - I replicate production
servers to a duplicate off-site. See "zfs send" and "zfs receive". Send
write so stdout an receive reads from stdin so you can send them over
ssh (or if local, use nc for speed). By having a replica of the whole
pool on another set of drives off-site is a comforting feeling. And the
best bit is you can do incremental updates (it only transfers the blocks
that have changed between snapshots).
If you're backing up on a local network to a SMB server, you can just
pipe the dataset(s) to a large file on that using zfs send. Windoze
won't know how to read it. If you have encrypted datasets you can
send/receive using the --raw option and then Windoze users won't even be
able to dump the file and look at it. By default it decrypts before
sending. If you do this you'll need to have kept the encryption key
somewhere safe and restore it with zfs load-key.
I still use tar to dump to tape at file level , just in case ZFS stops
working.
Speaking of tape, it's very easy to dump a dataset to a remote tape
drive: zfs send pool/dataset | ssh user@remote "cat >/dev/sa0"
That way if Amazon toasts your VM you have a an air-gapped copy in a
place ransomware can't touch it.
Regards, Frank.