# Advice on ZFS Backup



## WiseHacker (Oct 23, 2013)

First and foremost, sorry if this question has already been asked (the search popup is not working for me at the moment).

That aside, hopefully someone can clear a few things for me but first, if I may, a bit of background.

A while ago, I used PC-BSD to set up my own NAS Server using ZFS.  I know this is the FreeBSD forum, but underneath PC-BSD most FreeBSD and I am after ZFS advice which (as far is I can tell) comes straight from FreeBSD anyway (I think only the package manager is different when comparing the two).

Anyway, I am moving to PC-BSD 9.2 but as I installed one of the pre-rolling release versions, I have no upgrade path to PC-BSD-9.2.

The problem is I wish to play it safe and backup my data.  I use nested ZFS file systems (some with compression, some with sharing enabled, etc) and it has occurred to me I have no idea how to properly back up a ZFS system.

From what I have read from online sources, I can use the snap shot mechanism but some sources conflict with each and when they are not conflicting they are being vague.

In terms of my system:

I have two 3 TB pools (the operating system is on yet another hard drive so all data is separate device and pool wise).
One of the pools has nested files systems (some are meant for sharing, others are for file based backups so they have compression switched on).
I am after a thorough backup solution where I can backup both pools (and the complete file system hierarchy) to an external USB 3 or FireWire 800 drive.
This is what I am after in terms of a backup solutions:

I would like to be able to make a complete snapshot of both pools.
Transfer both pools to the backup device (with compression if possible to extend the use of the device)
Be able to fully restore the zpools if something goes horridly wrong during the upgrade.
Once the upgrade is successfully complete, I would like to know how I can send incremental snapshots to the backup device while being able to make a full restoration of the system if something damages my pools beyond repair.

Based on my current understanding, this is the chain of commands I need to run when performing a full back (in keeping with my backup plan externalPool being the name of my external device, compression switched on and deduplication on the stream to further reduce the stream size).

`zfs snapshot -r internalPool@fullBackup`
`zfs send -R -D internalPool@fullBackup | zfs recv externalPool@fullBackup`

And if I wish to perform a restoration: `zfs send externalPool@fullBackup | zfs recv internalPool@fullBackup`.

I know I could redirect the streams into files but from what I can tell this will not work if I want to make incremental backups after my upgrade 9.2.

Sorry if this is a rather long and odd post but I look silly asking such questions now than dumb later when I lose all my data.

Needless to say if I get any advice I am still going to practice on some dummy data first to make sure I get the art of ZFS backups right.

My thanks in advance.


----------



## Sebulon (Oct 24, 2013)

Hi @WiseHacker!

Perhaps this might be of interest: replicate - Initial and continous ZFS filesystems replication.

/Sebulon


----------



## AndyUKG (Oct 30, 2013)

Hi,

You should be good with the steps you propose. If you want to have the backup pool/datasets compressed when they are not compressed on the originals I think you'll need to enable this after starting the receive command, as I believe doing a full (as opposed to incremental) receive will set up the new datasets with the same options as the originals,

Thanks, Andy.


----------

