Will an rsync update destroy snapshot sharing?

Status
Not open for further replies.

toolforger

Explorer
Joined
Aug 8, 2017
Messages
60
Here's the scenario:
- Big file (megabytes).
- File gets sent to NAS via rsync. (Expectation: Used space goes up by file size.)
- NAS does a snapshot. (Expectation: Used space is essentially unchanged.)
- File gets sent to NAS again. What happens?

Things that *could* happen:
- Happy case: rsync detects that just the block is modified, updates the block. (Expectation: Used space goes up by size of changed block.)
- So-so case: rsync overwrites the entire file, but ZFS keeps blocks shared that would be unmodified after the overwrite. (I had hoped ZFS would be doing this, but some preliminary testing indicated it does not.)
- Bad case: The file will be fully stored in both versions.

To rephrase this as a question:
- Does ZFS snapshot sharing happen on a per-block or on a per-file level?
- Is rsync smart enough to transmit only those blocks that have been changed wrt. the target file?

Background info: rsync has a --blocksize options that makes me think that it *may* be smart enough to leave unchanged blocks alone, but the manual is maddeningly imprecise.

I have a test running right now, but I guess I overdid the file size - I built a 64-GB file of random data, and current estimates for initial rsync transfer time is 10 hours.
Which seems a bit slow to me - FreeNAS is reporting ~9.5 MBit/s on bge0, which sounds like *some* hardware is pegged at 10 MBit/s. I don't see that transfer rate add up to 10 hours for 64 GB though; not sure what's going on here, but maybe I'm grossly miscalculating things.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,091
Does ZFS snapshot sharing happen on a per-block or on a per-file level
All of ZFS operates on blocks unless otherwise required by the filesystem abstraction.
 

toolforger

Explorer
Joined
Aug 8, 2017
Messages
60
I'm asking because some tests indicated otherwise.
I'm currently working on a reproducible test case. It's somewhat time-consuming because I need to write multi-gigabyte files to make any change register in the webgui, plus right now I'm investigating why the Ethernet connection is pegged at 10 MBit/s. Both issues are actually something for the Off-Topic forum, so I'll be posting there if/when I can post substantial questions.
 

toolforger

Explorer
Joined
Aug 8, 2017
Messages
60
rsync has too many options, one of which is --inplace and is handy for COW filesystems.

(for some reason, my original answer didn't make it to the forum, so here again:)

Thanks, it's indeed too many options, though I'd have real trouble naming even a single one that's superfluous...

Back on-topic:I had indeed overlooked --inplace, so my rsync testing would never trigger COW logic. I'm going to test things again soon-ish and be back with a new thread whenever I hit another roadblock.
 
Status
Not open for further replies.
Top