3

Is there a way I can send ONLY the latest snapshots to the backup zfs system even though it has previous snapshots? When I try I keep getting error:

"cannot receive new filesystem stream: destination has snapshots (eg. mirrorpool/ETC/Stuff) must destroy them to overwrite it"

And I was using zfs send receive with the -F already.

Basically the receiving system has not received a bunch of snapshots since I found it had run out of space. So I deleted a bunch of VERY old snapshots on the receiving zfs file system and left the more recent ones, but the zfs system that does the zfs send has a lot of even more recent snapshots that don't exist on the zfs receiver (backup server). But I do NOT want to replicate ALL the missing snapshots back to the snapshot they have in common. I would like to simply send the most recent snapshot couple snapshots to the zfs receiver.

Currently the zfs receiver has the first couple snapshots ever created and then the rest were deleted and only ones left were the latest it had from around sometime in October 2018. So I would like to avoid sending Every Daily snapshot since October 2018 from the Zfs Sender system to the zfs receiver and just send only the last couple snapshots.

Or is there some sort of just "rsync" type of zfs send | zfs receive where I can just keep the two datasets in-sync without sending over any snapshots?

6
  • AFAIK everybody just uses syncoid, which handles this more or less transparently. Apr 24, 2019 at 1:19
  • Yes thanks I was aware of sanoid/syncoid, zfs-auto-snapshot, zfsnap, znapzend etc and I may end up going with one in the end but initially I scripted my own manual stuff because I had to do a lot of non-standard ports and wake up remote systems first from sleep/hibernation and then put them back to sleep etc and using custom flags/compression and mbuffer for speedup etc.
    – htfree
    Apr 24, 2019 at 1:47
  • 2
    You should ask on Reddit r/zfs.
    – ewwhite
    Apr 24, 2019 at 3:25
  • Are there any snapshots in common between the sending and receiving dataset? Apr 24, 2019 at 11:57
  • Yes there is a common snapshot, its back in October 2018 but I wanted to avoid replicating every single "daily" snapshot between October 2018 and today, I want to send to the receiving zfs side just the last couple snapshots
    – htfree
    Apr 25, 2019 at 0:58

1 Answer 1

4

I'm having a little difficulty parsing your problem, but I think it works like this:

BoxA:pool/dataset@1,2,3,4,5,6,7,8,9,10

BoxB:pool/dataset@1,2,3

You want to get snapshot 10 on BoxB, but you don't want to have all the intermediate snapshots (4,5,6,7,8,9).

Assuming this is the case, it's simple enough:

root@BoxA:~# zfs send -Ri pool/dataset@3 pool/dataset@10 | ssh root@BoxB zfs receive pool/dataset

After this completes (notice we used lower case -i, not upper case -I!), you end up with the following situation:

BoxA:pool/dataset@1,2,3,4,5,6,7,8,9,10

BoxB:pool/dataset@1,2,3,10

Note that since we're specifying -R for zfs send, we're actually also going to be sending (and receiving) any hypothetical child datasets or zvols, such as pool/dataset/child0, pool/dataset/child1, and so forth. (Also be aware that things get kinda weird if you don't have the exact same snapshots available on all child datasets, when you use -R with zfs send.)

1
  • busy with perl headache now you can see my new question if you know, i think you understood my problem of not wanting 'all' of the intermediates between the 'common' snapshots, I had thought I had tried what you said but got error i mentioned, but perhaps i made mistake in my command, I will confirm when i get around to testing with your syntax, thanks!
    – htfree
    May 6, 2019 at 21:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .