ZFS "send and recv" don't include manual snapshots? Is there a secret option?

Joined
Oct 22, 2019
Messages
3,641
I have a USB drive to occasionally make an offsite backup of my main pool.

Using the "-i" option during "zfs send" does in fact save a lot of time, as it only transfers the difference between the previous (old) and current (newly created) recursive snapshot of my entire main pool and all child datasets.


So far, so good...


However, I noticed an issue. It does not seem to essentially "clone" my main pool to the USB drive, as it is missing manual (and important) snapshots I've created on a few datasets. Here is an example.


mainpool/user1home@before-migration <--- Not on USB drive after send-and-recv

mainpool/user1home@auto-20191123 <--- Exists on USB drive after send-and-recv

mainpool/user1home@auto-20191122 <--- Exists on USB drive after send-and-recv

mainpool/user1home@auto-20191121 <--- Exists on USB drive after send-and-recv

mainpool/archives/isos@before-migration <--- Not on USB drive after send-and-recv

mainpool/archives/isos@auto-20191123 <--- Exists on USB drive after send-and-recv

mainpool/archives/isos@auto-20191122 <--- Exists on USB drive after send-and-recv

mainpool/archives/isos@auto-20191121 <--- Exists on USB drive after send-and-recv




Yet if I do a FULL send (not incremental), it essential does clone everything, including all snapshots. The pool on the USB is 100% identical to my main pool on the NAS.

Is there a way to "clone" the entire main pool on the NAS to a USB drive, without having to do a full send each time (for the sake of speed and practicality), while preserving EVERY snapshot that exists, including manually created ones?
 

seanm

Guru
Joined
Jun 11, 2018
Messages
570
What's the exact commands you use (with all the flags)? Have you read the man page about the all options? Some talk about removing snapshots for example.
 
Joined
Oct 22, 2019
Messages
3,641
What's the exact commands you use (with all the flags)?

Code:
zfs rename -r mainpool@offsite-backup-new mainpool@offsite-backup-old

zfs snapshot -r mainpool@offsite-backup-new

zfs send -Ri mainpool@offsite-backup-old mainpool@offsite-backup-new | zfs recv -vFd usbdrive

zfs destroy -r mainpool@offsite-backup-old

zfs destroy -r usbdrive@offsite-backup-old
 

seanm

Guru
Joined
Jun 11, 2018
Messages
570
I think you'll want -I (not -i) on the send, and no -F on the recv. Again, best to read 'man zfs' and all the different option to send/recv.
 
Joined
Oct 22, 2019
Messages
3,641
I think you'll want -I (not -i) on the send, and no -F on the recv.

That did the trick! Thank you, seanm! I kept the -F and -d options, which are needed for my use. I want a perfect backup of everything, down to the naming scheme and snapshots. Anything not on the source (or previously removed), I also want removed from the offsite USB drive backup.


Again, best to read 'man zfs' and all the different option to send/recv.

Trust me, I did. My problem with man files and software documentation is sometimes the wording and phrasing is written from a developer's perspective. It makes certain things ambiguous and difficult to comprehend.
 
Top