2

I have a ZFS pool on SmartOS with 2-way mirrored disk. My wish is to experiment a little, and store snapshot as a backup to a different machine (laptop's HDD where FreeBSD is installed with ZFS, which has its own different pool).

Just need an input if this is correct way of doing things.

I'd send the snapshot via SSH. Can I store snapshot on laptop as a file then? I don't wish to mount the FS, or replicate/migrate the pool, just store it as an archive, in case something happens on SmartOS server, I can bring the pool back from backup location. I guess there should be no receive command on FreeBSD's end, correct?

Basically as I'm still exploring ZFS, I'm searching for more direct explanations on how this works. To put it short, I don't want to replicate/"revive" source pool on target, but store snapshot there so I have access to it on a different location. Obviously target and source differ, one is working server with RAID-Z the other one is single disk laptop. Would this mean sending snapshot as a file?

1
2

You can store zfs send as a file, but this is not recommended because there is no error checking at zfs send time - the only validation is at zfs receive time. If the stream gets damaged, the entire "zfs receive" operation will fail. So ideally, you should always pipe zfs send to zfs receive on the far end of the pipe.

There is no requirement for the target to be named the same thing as the source, e.g. you can zfs send sourcepool/sourcefs@snapshot | ... [pv | mbuffer ] ... | zfs receive targetpool/targetfs.

You should always pull backups rather than push them, i.e. your backup server needs ssh root access on the source, but your source should have no ssh root access to the backup server - otherwise if somebody compromises the server, they can also delete the backups.

I suggest you look at sanoid - it is an excellent solution for automated snapshotting, snapshot pruning, and backups (done by it's included counterpart called syncoid). It's mostly a set-it-and-forget-it solution for what you are doing that you are only going to have to touch when you have a hardware failure/upgrade or you run out of disk space.

2
  • It is possible to nominate specific user to be able to send snapshots of a set. SmartOS should allow it (it is a SunOS5 version.) Add a ssh key from the user on the backup server to a normal user on the smartos authorized_keys. Use zfs allow for your dataset to delegate send rights only. – Stefan Skoglund May 5 '20 at 19:31
  • I believe that is possible, though I never tried it, so I don't know for sure if syncoid will "just work" with that arrangement. I never saw key-only root auth from an "outgoing access only" node as a risk. – Gordan Bobic May 5 '20 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.