4

How do I change the default options for zfs filesystems on an existing zpool?

That is, ZFS stored for each zpool pool the default values for new zfs filesystems. Those are then used by zfs create as default values if they aren't explicitly overwritten.

I know that zpool allows to set those default values on creation, by using the capital -O flag:

zpool create -O atime=off -O compression=on ...

That way, all filesystem creation commands can be shortened from:

zfs create -o atime=off -o compression=on ...

to:

zfs create ...

However, what if I didn't set the -O on zpool creation? How can I set or change them for an existing pool?

Update

The following command finally worked for me:

zfs set atime=off compression=on zroot

Thanks to @ewwhite and @shodanshok.

vog
  • 548
  • 5
  • 11

2 Answers2

8

You can just use zpool get all to show available pool options and zpool set option= on the desired option.

For filesystem options, you view/set them with zfs get and zfs set on either the top-level filesystem or individually on the sub-filesystems (who otherwise inherit the options from the top level).

ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • 4
    @ewwhite is right: you can/should simply set ZFS options for the root dataset, ie: `zfs set xattr=sa tank`. Moreover, please do not downvote answers you do not fully understand – shodanshok Feb 25 '19 at 14:40
  • 2
    @vog Not sure why you downvoted, as this is the correct answer. You just run `zfs set atime=off compression=on tank` and you're done. – Michael Hampton Feb 25 '19 at 14:58
  • @vog Click the "edit" link, then, and edit the answer. – Michael Hampton Feb 26 '19 at 13:24
  • @vog What the heck is wrong with you? This is _everything_ that's wrong with helping people online. – ewwhite Feb 28 '19 at 03:42
  • 1
    @ewwhite I'd love to fix my mistake and upvote your answer, but StackExchange doesn't allow me to do that until you (or somebody else) edits your answer. I wanted to improve your answer myself, too, but my edit hangs in the peer review. I just retried with a slightly different edit. – vog Feb 28 '19 at 08:03
  • 1
    @vog Your suggested edit didn't just make those minor changes; it went much farther. – Michael Hampton Feb 28 '19 at 15:26
  • @MichaelHampton Still no luck with peer review. I came to the conclusion that here on ServerFault the only acceptable way to include my improvement is to append it to my question. (The StackOverflow community seems to be very different in that regard, which adds to my confusion.) – vog Mar 01 '19 at 08:20
4

Adding to the answer of @ewwhite, while most properties are propagated to child datasets on creation, so you may have to run it on each pre-created filesystem / zvol manually to make the whole pool have the same properties.