Is a ZFS Snapshot to an external disk a backup?

Status
Not open for further replies.

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
This difference is not specified in posts where one says, often in bolded text by a senior member, "snapshots are not a redundant backup of data", or at least I've never come across a post that has differentiated the two, of which then leads lay users to believe there isn't a differentiation.
I don't think I'm familiar with the posts to which you're referring, and I expect the context in which those statements were made is going to be pretty important. But if you think through it a little bit, and have the most basic understanding of what ZFS snapshots are, it should be obvious. Snapshots in your pool will be subject to any hazards that could befall that pool. If two disks die in your RAIDZ1 pool, the pool's gone, and all the snapshots on that pool with it. But if you're replicating your snapshots to another pool (whether on the same server, another server on your LAN, or one on the other side of the world), that's a separate copy of your data. If your pool dies, it won't hurt the data on that other pool.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
@danb35 What are the advantages to utilizing snapshots as a backup via external replication with zfs send, versus that of using rsync in archive mode, with a command similar to: rsync -avrt --human-readable --partial --stats --info=name0"
As the question has been addressed by many who know much more than I, I'll just give the following links (from the first page of a Google search for "zfs replication vs rsync"):
https://arstechnica.com/information...on-to-the-cloud-is-finally-here-and-its-fast/
https://forums.freenas.org/index.ph...-snapshot-replication-vs-other-over-wan.9695/ (along with a number of other threads here)
https://serverfault.com/questions/189420/zfs-sync-over-unreliable-slow-wan-zfs-replication-or-rsync
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
zfs replication backs up the pool, rsync backs up the files. Thus you can restore the pool, essentially as it was, including all its configuration parameters and properties.

zfs replication begins virtually instantly, rsync has to compare files, which for large file sets can take a large amount of time.

zfs replication provides a high throughput data stream, rsync might not.

zfs replication requires a common snapshot to be present on both pools to transmit a delta. rsync does not. If there is no comon snapshot, then the whole pool/dataset will be transmitted.

zfs replication is one way, rsync can be bi-directional.

Imagine you have a pool of data... and you continuously add more data to the pool...

When you send a snapshot to another host/pool/dataset, you simply send all the data that was added/changed in the pool since the last snapshot was sent.

This is how zfs works.

Rsync examines every file on both systems, works out if they are different, then examines each block of each different file and transmits the differences. Every time. Its very clever about it, but its a very complicated process.
 

zoomzoom

Guru
Joined
Sep 6, 2015
Messages
677
@danb35 & @Stux Thanks! =] The links and the explanations helped a great deal
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
When you send a snapshot to another host/pool/dataset, you simply send all the data that was added/changed in the pool since the last snapshot was sent.
...and ZFS can do this very efficiently because each snapshot refers to a particular transaction group, and ZFS has (in effect) a database of what blocks were touched by which transaction groups. With that database, it becomes near-trivial to send only the changed data.
 

guermantes

Patron
Joined
Sep 27, 2017
Messages
213
Yes, they are equivalent. i.e. a view of the filesystem at a point in time.

To restore you would create a pool and send the backup snapshot to the new pool. Easy. :)

The part about the "backup snapshot" confuses me.
I did zfs snapshot TANK/foto@foto180226 and then zfs send TANK/foto@foto180226 | zfs recv BACKUPDISK/fotobackup where BACKUPDISK is an external USB3 drive. I then detached the USB drive and attached it to a laptop with ZFS on Linux installed. I did zfs import BACKUPDISK and it was mounted. zfs list -t snapshot on the laptop shows me the snapshot is there. But I also have access to the actual files (I can view photos and videos). I was not expecting to be able to actually view and use the files in the backup (I guess I expected them to be unreachable inside some kind of snapshot container). Is this the expected behaviour?
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
(I guess I expected them to be unreachable inside some kind of snapshot container).
No, snapshots aren't crappy blobs you can't peer into. They're ZFS filesystems in their own right, much like their parent dataset. They're read-only, but you can clone them and do stuff in the clone.

But I also have access to the actual files (I can view photos and videos). I was not expecting to be able to actually view and use the files in the backup
You say that almost like it's a bad thing. ZFS was and still is developed by people who eat their own dog food. You can bet that they're going to make it really usable and send/recv is part of it.

Fun fact: Folklore has it that Matt Ahrens wrote send/recv when he was sent to China, so that he could continue to work on his stuff.
 

guermantes

Patron
Joined
Sep 27, 2017
Messages
213
You say that almost like it's a bad thing.
That was certainly not intended. I am glad to know I am doing things right so far. Thanks for confirming.
 
Status
Not open for further replies.
Top