ZFS incremental send on recursive snapshot

Status
Not open for further replies.

frenziedengi

Dabbler
Joined
Feb 22, 2013
Messages
14
I am trying to understand ZFS send behavior, when sending incrementally, for the purposes of backup to another (local) drive.

Consider the following situation:
  • volume = tank
  • Datasets: tank/stuff1, tank/stuff2
  • I take a recursive snapshot:
    Code:
    zfs snapshot -r tank@initial
  • I send it:
    Code:
    zfs send -R tank@initial | zfs recv -Fduv tankb/tank
  • Later on, I create a new data set: tank/stuff3
  • I take a recursive snapshot:
    Code:
    zfs snapshot -r tank@second
  • I send it, incrementally:
    Code:
    zfs send -Ri @initial tank@second | zfs recv -Fduv tankb/tank
Question:What happens to tank/stuff3, since it was not present in the initial snapshot set sent over?
Follow up: How do people typically handle this situation where you would like to keep things incremental, but datasets may be created at a later time?

I investigated what happens some. I get this error when doing this second send:
Code:
local fs tank/stuff3 does not have fromsnap (initial in stream); must have been deleted locally; ignoring

Ultimately, it appears that the contents of stuff3 are transferred as part of this exchange. How does this work? What does "ignoring" mean?
 

Dusan

Guru
Joined
Jan 29, 2013
Messages
1,165
It's ignoring the incremental option and creating a full stream for that dataset. A comment from libzfs_sendrecv.c:
Code:
        /*
        * If this fs does not have fromsnap, and we're doing
        * recursive, we need to send a full stream from the
        * beginning (or an incremental from the origin if this
        * is a clone).  If we're doing non-recursive, then let
        * them get the error.
        */

If you try to do a non recursive replication while missing the initial snapshot you will get a hard error -- the replication will fail. If you do a recursive replication you will see the warning, but the replication will proceed sending a full stream.
 

frenziedengi

Dabbler
Joined
Feb 22, 2013
Messages
14
Excellent. This is exactly the behavior I wanted.
Thanks for the research to the source!
 
Status
Not open for further replies.
Top