Is there a way to set multiple ZFS filesystem properties at once?

Solution 1:

Depends on the implementation.

On FreeBSD (10.3-STABLE) you can:

# zfs create zfsroot/test
# zfs set compression=lzjb sync=disabled zfsroot/test
#

And on Solaris (11.2) you can't:

# zfs create rpool/test
# zfs set compression=on sync=disabled rpool/test
cannot open 'sync=disabled': invalid dataset name
#

Since I don't have a Linux with zfs, this one is for you to discover. :)

Solution 2:

I realise this might be a bit late, but that's what the -O (uppercase letter) is for: the pool's root dataset. Lowercase letter -o is for pool properties. I used this in Ubuntu/ZoL but FreeBSD seems to have it too. Oh would you look at that, seems Solaris does too!