Understanding zfs send receive with snapshots

johns007

Dabbler
Joined
Mar 21, 2019
Messages
17
Hi,

I would like to seek some clarity with the usage of zfs send receive with snapshots.

when i send a fresh new pool of data to another system the straightforward methods are well known with:

zfs send -Rv Pool@snapshot | (insert ssh here) zfs receive -dF pool2

Now comes my actual question:
when i want to update the pool that i just sent to the other pool via ssh with incremental flag:

zfs send -Rv -i Pool@snapshot Pool@snapshot1 | (insert ssh here) zfs receive -dF pool2

it seems i can't get it to work. I want the original snapshot compared to new snapshot1 to send the difference to the remote server, is this correct?

I seem to try it, but there is no change on the receiving end after it does it's thing, where am i going wrong?
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
You should try the following:

[cmd]zfs send -R -I Pool@snapshot Pool@snapshot1 | (insert ssh here) zfs receive pool2@snapshot[/cmd]
zfs send -R -I Pool@snapshot Pool@snapshot1 | (insert ssh here) zfs receive pool2


I never tried Recursive incremental replication as I have a script that takes care of it.
The key, is the capital "I" for incremental and to retain/update permission and such from the source.
You also need to provide the name of the snapshot that is the most recent, ie. last, from the destination pool.

PS: edited as the last snapshot sent to the destination (pool2) is actually taken care of at the source.
 

johns007

Dabbler
Joined
Mar 21, 2019
Messages
17
You should try the following:

[cmd]zfs send -R -I Pool@snapshot Pool@snapshot1 | (insert ssh here) zfs receive pool2@snapshot[/cmd]
zfs send -R -I Pool@snapshot Pool@snapshot1 | (insert ssh here) zfs receive pool2


I never tried Recursive incremental replication as I have a script that takes care of it.
The key, is the capital "I" for incremental and to retain/update permission and such from the source.
You also need to provide the name of the snapshot that is the most recent, ie. last, from the destination pool.

PS: edited as the last snapshot sent to the destination (pool2) is actually taken care of at the source.
Would i not still require the -dF switches for the receiving end ?
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
Would i not still require the -dF switches for the receiving end ?
Not necessarily.
If the volume receiving the snapshots is set to "read only", then using the "-F" option shouldn't be necessary as it is intended to perform a Rollback.
This is only required if the system on the remote has made changes to the filesystem.

I can't remember what the "-d" option really does. I think it is intended at destroying snapshots that are either too old or destroy the last snapshots that are present on the receiving but no longer on the sending side until a common snaphsot is found and replication can start.
 

johns007

Dabbler
Joined
Mar 21, 2019
Messages
17
Not necessarily.
If the volume receiving the snapshots is set to "read only", then using the "-F" option shouldn't be necessary as it is intended to perform a Rollback.
This is only required if the system on the remote has made changes to the filesystem.

I can't remember what the "-d" option really does. I think it is intended at destroying snapshots that are either too old or destroy the last snapshots that are present on the receiving but no longer on the sending side until a common snaphsot is found and replication can start.

Thank you, i think it could be the cause of some of my troubles. The -F is not necessary your right!

If the -d option is specified, all but the first element of the sent snapshot's file system path (usually the pool name) is used and any required intermediate file systems within the specified one are created. It maintains the receiving pools name, rather than renaming it to resemble the sending pool name. So i consider it important since i call it "Pool2" .
 

johns007

Dabbler
Joined
Mar 21, 2019
Messages
17
One Other thing, just wish i could do the above, easily with the gui. Would make life much easier than typing it in to ssh.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
One Other thing, just wish i could do the above, easily with the gui. Would make life much easier than typing it in to ssh.
Surprise - you can. Look up Replication Tasks in the manual.
 

johns007

Dabbler
Joined
Mar 21, 2019
Messages
17
Surprise - you can. Look up Replication Tasks in the manual.
Thank you Patrick, Just updated my freenas to new version "yay" and it's very exciting to see the new changes. Very polished and has the awesome replication tasks added, with a new wizard. This stuff is truly legendary. Just wish i could set it up to operate in other circumstances, for example, with a pull out drive in the server for offsite storage.
Case usage scenario:
Backup drive is a spare independent pool, different to the main vdev pool. It's not mirrored, simply a zfs volume on a hard disk with appropriate size.
Insert the drive "Some configs, allow hot removable/swappable, some don't" < point made however, once the drive is inserted, the system should immediately pick up on this and run the replication task. Alternatively a quick programmable "once off" set would be great, it has it, but it doesn't store it. Needs to store it as a regular function, if you know what i mean!
 
Top