Querying ZFS Properties
The simplest way to query property values is by using the zfs list
command. For more information, see Listing Basic ZFS Information. However, for complicated queries and for scripting, use the zfs get
command to provide more detailed information in a customized format.
You can use the zfs get
command to retrieve any dataset property. The following example shows how to retrieve a single property value on a dataset:
$ zfs get checksum tank/ws
NAME PROPERTY VALUE SOURCE
tank/ws checksum on default
The fourth column, SOURCE
, indicates the origin of this
property value. The possible values for SOURCE
are:
-
default
-
This property value was never explicitly set for this dataset or any of its ancestors. The default value for this property is being used.
-
inherited from
dataset-name -
This property value is inherited from the parent dataset specified in dataset-name.
-
local
-
This property value was explicitly set for this dataset by using
zfs set
. -
temporary
-
This property value was set by using the
zfs mount -o
command and is only valid for the duration of the mount. For more information about temporary mount point properties, see Using Temporary Mount Properties. - - (none)
-
This property is read-only. Its value is generated by ZFS.
You can use the special keyword all
to retrieve all dataset property values. The following examples use the all
keyword:
$ zfs get all tank/home
NAME PROPERTY VALUE SOURCE
tank/home aclinherit restricted default
tank/home aclmode discard default
tank/home atime on default
tank/home available 274G -
tank/home canmount on default
tank/home casesensitivity mixed -
tank/home checksum on default
tank/home compression off default
tank/home compressratio 1.00x -
tank/home copies 1 default
tank/home creation Tue Jul 30 10:08 2013 -
tank/home dedup off default
tank/home defaultgroupquota none -
tank/home defaultuserquota none -
tank/home devices on default
tank/home encryption off -
tank/home exec on default
tank/home keychangedate - default
tank/home keysource none default
tank/home keystatus none -
tank/home logbias latency default
tank/home mlslabel none -
tank/home mounted yes -
tank/home mountpoint /tank/home default
tank/home multilevel off -
tank/home nbmand off default
tank/home normalization none -
tank/home primarycache all default
tank/home quota none default
tank/home readonly off default
tank/home recordsize 128K default
tank/home referenced 31K -
tank/home refquota none default
tank/home refreservation none default
tank/home rekeydate - default
tank/home reservation none default
tank/home rstchown on default
tank/home secondarycache all default
tank/home setuid on default
tank/home shadow none -
tank/home share.* ... default
tank/home snapdir hidden default
tank/home sync standard default
tank/home type filesystem -
tank/home used 31K -
tank/home usedbychildren 0 -
tank/home usedbydataset 31K -
tank/home usedbyrefreservation 0 -
tank/home usedbysnapshots 0 -
tank/home utf8only off -
tank/home version 6 -
tank/home vscan off default
tank/home xattr on default
tank/home zoned off default
The -s
option to zfs get
enables you to specify, by source type, the properties to display. This option takes a comma-separated list indicating the desired source types. Only properties with the specified source type are displayed. The valid source types are local
, default
, inherited
, temporary
, and none
. The following example shows all properties that have been locally set on tank/ws
.
$ zfs get -s local all tank/ws
NAME PROPERTY VALUE SOURCE
tank/ws compression on local
Any of the above options can be combined with the -r
option to recursively display the specified properties on all children of the specified file system. In the following example, all temporary properties on all file systems within tank/home
are recursively displayed:
$ zfs get -r -s temporary all tank/home
NAME PROPERTY VALUE SOURCE
tank/home atime off temporary
tank/home/sueb atime off temporary
tank/home/mork quota 20G temporary
You can query property values by using the zfs get
command without specifying a target file system, which means the command operates on all pools or file systems. For example:
$ zfs get -s local all
tank/home atime off local
tank/home/sueb atime off local
tank/home/mork quota 20G local
For more information about the zfs get
command, see the
zfs
(8) man page.