openzfs/zfs

zfs send --props or -R do not send inherited properties

Closed this issue · 5 comments

System information

Type Version/Name
Distribution Name Debian
Distribution Version bookworm
Kernel Version 5.15.0
Architecture amd64
OpenZFS Version zfs-2.1.2-1

Describe the problem you're observing

When using zfs send to send a dataset, I want to send its properties. Namely, the ones that involve tuning of the data. That would include compression, atime, xattr, dnodesize, recordsize, and others.

The man page says that I can do this with -p/--props or it will also be implied by -R. I'm also told that if I am sending an encrypted data set, I need to use -w (raw) to send props as well.

In my testing I have discovered that only properties explicitly locally set on a dataset are actually sent. If a property is inherited from a parent, it will not be propagated to the target -- even if it is a non-default value.

This isn't ideal. My use case here is sending some (but not all) child datasets for an offsite backup. I want those properties to be accurate since there may come a time where the replica must be promoted or restored somehow, and I may not remember what my various settings were.

The man page does not mention that inherited properties are not sent, and although it seems to me it should include any non-default property, I don't know whether this was an intentional decision. If it is designed this way, it would be good to see an update to the man page for zfs-send for clarification.

Describe how to reproduce the problem

# assume dnodesize is at default (legacy) on tank
zfs create tank/testsrcparent
zfs set dnodesize=auto tank/testsrcparent
zfs create tank/testsrcparent/testchild
# testchild has now inherited dnodesize=auto
touch tank/testsrcparent/testchild/honk
zfs snapshot tank/testsrcparent/testchild@go

# dnodesize on this set remains at legacy, the default
zfs create tank/testdestparent

# perform send with --props
zfs send --props tank/testsrcparent/testchild@go | zfs recv tank/testdestparent/testchild

# confirm dnodesize is still legacy and was not copied
zfs get dnodesize tank/testdestparent/testchild

I found two closed issues without a clear resolution here:
#2121
#5967

It is awfully confusing that there's not clarity in the docs. Intuitively, I would expect any non-default property to propagate. Inherited properties are still important properties tied to the type of data in the dataset.

Given that it has worked like this since OpenSolaris, and has not been changed, I believe you may safely conclude it is by design.

+1 for (A) edit the man page or (B) change the behavior of -R / --props

you are right, IMHO the man page is false or at least not clear enough. The man page implies that REALLY all props are send.

But i think option (B) is the better way to handle it. When a lot of properties (in your example only dnodesize) is only customized on parent dataset (so all properties are inherited) there is currently no easy way to send & recv a child dataset with those properties (you have to use -o on the recv side), right?
The command in your example:
# perform send with --props zfs send --props tank/testsrcparent/testchild@go | zfs recv tank/testdestparent/testchild
is the same as without --props
# perform send WITHOUT --props zfs send tank/testsrcparent/testchild@go | zfs recv tank/testdestparent/testchild
which IMHO is not what the user should expect when using --props explicitly.
So using -R oder --props should make all inherited properties on sending side -> received/local on the recv side

A similar confusion exists with (inherited) encryptionroots, where a similar documentation deficiency had been identified. #12000 #12649

stale commented

This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions.