-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --snapshot-property argument to pass to zfs snapshot #146
Add --snapshot-property argument to pass to zfs snapshot #146
Conversation
Also a bit curious on zfs properties behaviour. I couldn't find the explanation in the zfs docs, but find that properties are NOT creating a persistent history with e.g. no history of property changes like this
vs
is that a zfs bug or intended behaviour? |
good question and very interesting indeed |
can you call it --set-snapshot-properties and make it behave like --set-properties? (e.g. commaseperated multiple properties) |
It's intended behavior, this exact behavior not very clearly documented on it's own, but to actually understand the behavior one has to fully understand zfs properties. In ZFS, there are two distinct types of properties, which both are settable with
The behavior you are seeing here is that hierarchically snapshots are descendants of the dataset they're taken from; hierarchically their parent is the dataset itself, and so if there is no locally set property value (on the snapshot itself), as per the inheritance rules, ZFS will look for a value on the parent, and if it can't find a value on the parent, it will proceed to the parent of that, and so on. Thus, when you do Another point worth noting is that while user properties are settable on snapshots, native properties in general are not. For example, both of these will work:
but neither of these work:
|
very interesting. I can imagine they did this so that the properties on a snapshot are "frozen" as well, just like the snapshot itself? e.g. you can only set them when creating the snapshot, and never change them again after that? |
It depends on the property, but in general that's what happens most of the time, but you should not assume that's always the case. For example, the On the other hand for example the In general it's important to remember that snapshots should be more thought of as "snapshots of the data on the dataset", and not necessarily "snapshots of the data on the dataset including metadata about the dataset that exists in the zpool where the dataset resides in" |
no i meant user properties that are set during zfs snapshot -o test:test=blah it would make sense that they are immutable after creating the snapshot |
Thanks for the detailed explanation Scrin. Looks like props set on snapshots are in fact mutable
However this feature is still useful to me |
…the same was as --set-properties
Hmm aside from syntax error in that last change, the patch is no longer working for me... My original testing was branched off v3.1.1, not sure where I messed up yet EDIT nvm, think it was my venv |
Correct, user properties on snapshots are mutable as well. You could for example use user properties on snapshots to mark which of the snapshots have been already synchronized elsewhere |
thanks for your contribution :) |
Just exposing the property argument of zfs snapshot
From zfs snapshot man page:
This is a different effect than changing a property on received. Also not the same as a pre-snapshot
zfs set
. A possible use-case is tracking info that should live with the atomic snapshot.Example of pulling snapshots from different nodes and tracking where the snapshot came from