Hello,

I recently asked myself this question: Is it possible to unset ZFS properties? Or reset one to its default state without looking up what that default state is? I believe the answer is yes, via the zfs inherit command (I haven't verified yet, but I think a case could be made to add functionality to the zfs set command...or the documentation...to make this clearer.)

An example:
You have a pool named tank.
You have created a filesystem called 'home' and it has a child filesystem called 'smith'.
You run: zfs set compression=on tank/home
which turns on compression on the 'home' filesystem (it is a local property) and on the 'smith' filesystem (as an inherited property). (You inspect the properties with 'zfs get'.)

You then run: zfs set compression=on tank/home/smith
which makes compression on the 'smith' filesystem also be a local property.

At this point you decide you would rather that the compression property for filesystem 'smith' be inherited after all, not be a local property anymore.

You run:
zfs set compression=off tank/home/smith
but that doesn't unset the compression setting for filesystem 'smith', it just overrides the inheritance of compression=on (as expected).

So how to unset/reset?

In looking for an answer I went back to the page where I found the available properties and their valid parameters:
Introducing ZFS Properties
http://docs.sun.com/app/docs/doc/817-2271/gazss?l=en&a=view

I didn't see anything under 'zfs set' or under the 'compression' section for how to unset a property. I did find a link to this page:
Setting ZFS Properties
http://docs.sun.com/app/docs/doc/817-2271/gazsp?l=en&a=view

which had a link to this page:
man pages section 1M: System Administration Commands
http://docs.sun.com/app/docs/doc/819-2240/zfs-1m?l=en&a=view

which talked about 'zfs inherit' and 'zfs set':
zfs inherit [-r] property filesystem|volume|snapshot ...
zfs set property=value filesystem|volume|snapshot ...

*****
In short, I think an alias for 'zfs inherit' could be added to 'zfs set' to make it more clear to those of us still new to ZFS. Either that, or add some additional pointers in the Properties documentation that the set command can't unset/reset properties.
The alias could work like this:
If someone issues a command like this:
zfs set property=inherit filesystem|volume|snapshot
then run this code path:
zfs inherit property filesystem|volume|snapshot

The -r command could be added to 'zfs set' as well, to allow 'zfs set' to recursively set local properties on child filesystems.
zfs set -r property=inherit filesystem|volume|snapshot
then run this code path:
zfs inherit -r property filesystem|volume|snapshot

Another example if zfs set was extended:
zfs set -r compression=on tank/home
would set a local property of compression=on for 'home' and each of its child filesystems. (new functionality)

zfs set -r compression=inherit tank/home
would set the property of compression to default for 'home' and each of its child filesystems. (alias of zfs inherit -r compression tank/home)

zfs set compression=inherit tank/home
would set the property of compression to default for 'home' and leave the child filesystems properties untouched (alias of zfs inherit compression tank/home)


_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to