ZFS Recursively setting attributes

While working with zfs attributes I've noticed myself bending over backwards to set zfs attributes for multiple datasets that shouldnt inherit from their parent. Sometimes I'll set useless attributes to the parent dataset so I can inherit more conveniently, but usually I end up using shell expansion. Im sure there must be a proper way im missing, or some design philosopy that went over my head. Any suggestions
 
Without any more details, group your datasets by what properties they need, and then set mountpoints for where you need them?
Sorry if i didnt make myself very clear,

Heres an example of what I'll do:
Code:
zfs set x=y zroot

for i in $(ls zroot); do zfs inherit -r x zroot/$i ; done
this seems like a simple thing, and I figured ZFS must have a built in command way to accomplish it.
 
Properties are inherited by default for all but a few properties, like canmount. For what you’re doing above, assuming they aren’t already set on the descendant file systems, settings at the top level are inherited by default.

Using zfs inherit is to re-enable this (default) inheritance when for a parameter previously (manually) assigned locally.
 
Properties are inherited by default for all but a few properties, like canmount. For what you’re doing above, assuming they aren’t already set on the descendant file systems, settings at the top level are inherited by default.

Using zfs inherit is to re-enable this (default) inheritance when for a parameter previously (manually) assigned locally.
That's right, I'm not aware of a way to recursively set, reset, or flush out existing parameters so I hack inheritance to get the job done.
 
That's right, I'm not aware of a way to recursively set, reset, or flush out existing parameters so I hack inheritance to get the job done.
To recursively set prop for pool/fs/root and descendants with the exception of a few (eg mountpoint) non-inherited props:
zfs set prop=val pool/fs/root

Recursively reset (restore prop to inherited (if set "higher" in the tree) or default otherwise, or remove (if a user prop)):
zfs inherit -r prop pool/fs/root

I'm not sure what you mean by "flush out".
 
You can delete a user property (those with a colon, e.g. com.sun:auto-snapshot:yearly) with the zfs inherit command, e.g zfs inherit com.sun:auto-snapshot:yearly <dataset>.
From RTFM zfs(8): Use the "zfs inherit" command to clear a user property. If the property is not defined in any parent dataset, it is removed entirely. Property values are limited to 1024 characters.
 
You can delete a user property (those with a colon, e.g. com.sun:auto-snapshot:yearly) with the zfs inherit command, e.g zfs inherit com.sun:auto-snapshot:yearly <dataset>.
From RTFM zfs(8): Use the "zfs inherit" command to clear a user property. If the property is not defined in any parent dataset, it is removed entirely. Property values are limited to 1024 characters.
Inheriting nonexistance, thats fun. I think a parent should be able to force behavior on its lineage, as well as trusting the child to imitate its behavior. Maybe the developers are training us to be better parents.
 
Back
Top