ZFS ZFS send/receive unexpected behaviour

Hello,
I have two zpools named tank and storage0.
Tank is the system with root on zfs, storage0 is the backup destination.
I want to backup the whole tank disk as a live system onto storage0.

I have several snapshots on tank, for examples sake named @someSnap

I do the following:

zfs snapshot -r tank@backup_root

This creates @backup_root snapshots on all datasets, and incremental snapshots on top of @someSnap.

zfs send -R tank@backup_root | zfs receive -Fd storage0/tank

This command cancels after some time, with messages:
...
"cannot receive incremental stream: destination storage0/tank/somePath does not exit."

What zfs tries to do, is create the incremental snapshot @backup_root on top of snapshot @someSnap.
Whereas the initial replication of @someSnap is not possible for some unknown reason, I suppose.

I can solve it by creating all the paths manually, after which the @someSnap snapshots are created correctly.

This seems horrible. Is this intended, is there a way around it, or am I missing an option like -p for zfs create, to create needed directories/ parent directories automatically?

Kind regards
 
No, that seems like a setup that should work.

Is the zfs recv being run by root? Any options like readonly set on some datasets? Try receiving without mounting (-u on recv) to see if that helps.
 
  • Thanks
Reactions: wbq
Thank you very much for the reply.

The problem was, that I had been trying to run the receive commands with:
zfs receive -Fdvn, which I seem to have failed typing in the opening post.

With -n the call failed, which is understandable. I thought of the option as some kind of "whole simulation", but there are no emulated steps, so it simply fails when previous steps are missing.

I was wondering about the -u option.

What advantages does not mounting the receiving file system have?

Also, to prevent mount point conflicts, I set "canmount=noauto" for the backup dataset.
I was wondering, if I want to use the system as live backup,
can I simply set in the loader.conf:
vfs.root.mountfrom="zfs:storage0/tank"

to use the backup as root?

The option "noauto" is supposed to work with explicit mounts.
 
Back
Top