ZFS Best / proper way to backup a zroot pool to antoher pool / drive?

Hey Guys! :)

Whats the best / proper way to backup a zroot pool to antoher pool / drive?

My setup:
  • 2x 250GBs SSDs (zroot | mirrored)
  • 1x 500GB HDD (backup drive)
My goal: Backup the entire zroot pool to the backup drive in a limited dataset (250GB) and regularly do automatic snapshots.

Thanks in advance :)
 
'Best' really depends on the situation and your own expectations. This includes time of recovery when something does go wrong.

I usually make snapshots, keep a certain retention (usually 7 days on private servers) and then send those using zfs send to another host on which I store the data as a file, sometimes also compressed (this varies per filesystem), mostly relying on ssh as "tunnel" but I also sporadically use a VPN.

The reasoning behind this is that those off-site copies are only there for worst case scenarios. My pool is mirrored so one drive dying won't immediately lead to data loss. As such I also treat on-site snapshots as a means of backup.

Worst case scenario basically means that the whole system has to be recovered and then it can actually be faster if you can simply stream the file from the remote and then process the incoming data through zfs receive. Although you could replicate the whole filesystem on a remote host it becomes tedious if you have to restore a backup again. Because now you'd have to 'archive' the data on the backup host, transfer it to the main and then process it again. That'll be slower than simply starting a stream on the backup host which can then be processed on the main host.

I know some people use this setup so that they have access to all the individual files, but there usually isn't a need for that (in my opinion) because a snapshot can always be accessed on a per-file level on the main host through the hidden .zfs directory.

Hope this can give you some ideas.
 
Attempting to back up the full zroot will probably get messy, and awkward to restore... which is why there is already a popular tool to manage bootable zroot snapshots - beadm. However, beadm literally just snaps zroot; it leaves your home and data directories alone. (iirc) hint: a zroot install conveniently puts your home directory in its own dataset.

That said, feel free to do recursive snapshots of zroot, and zfs send them somewhere. You can clone whole datasets or you can send incremental updates. Also remember, you can pipe zfs send into whatever you want, such as a plain old file.

The real answer here is that the best way to backup your system is to read the manpages on send and receive, try some things out in a VM, and write a script that suits your needs. The possibilities are endless
 
Back
Top