| |||||||||||||||||
5.3 Querying Filesystem InformationThe zfs list command provides an extensible mechanism for viewing and querying dataset information. Both basic and complex queries are explained in this section. 5.3.1 Listing Basic InformationBasic dataset information can be seen using zfs list with no options. This invocation will display the names of all datasets on the system include their used, available, referenced, and mountpoint properties. See 5.2 ZFS Properties for more information about these properties.
The zfs list command can be refined to display specific datasets by providing the dataset name on the command line. Additionally, the -r option can be added to recursively display all descendants of that dataset. The example below uses zfs list to display tank/home/chua and all of its descendant datasets.
5.3.2 Complex QueriesThe output displayed by zfs list can be customized through the use of the -o, -f, and -H options. The -o option provides support for customizing the property value to be output. This option expects a comma separated list of the desired properties where any dataset property can be supplied as a valid value. See 5.2 ZFS Properties for a list of all supported dataset properties. In addition to the properties defined in the Properties section, the -o option list can also contain the literal name to indicate that the output should display the name of the dataset. The example below uses zfs list to display the dataset name along with the sharenfs and mountpoint properties.
The -t option provides the capability of specifying which type(s) of dataset(s) should be output. The valid types can be seen in the table below. Table 5-1 Types of Datasets
The -t options takes a comma separated list of the types of datasets to be displayed. The example below uses the -t and -o options simultaneously to show the name and used property for all filesystems.
The -H option can be used to omit the zfs list header from the generated output. When using the -H option, all white space is output as tabs. This option can be useful when parseable output is needed (for example, when scripting). The example below shows the output generated from an invocation of zfs list using the -H option.
5.4 Managing PropertiesDataset properties are managed through the set, inherit, and get subcommands. 5.4.1 Setting PropertiesThe zfs set command can be used to modify any settable dataset property, see 5.2.2 Settable Properties for a list of settable dataset properties. The zfs set command takes a property/value sequence in the format of property=value and a dataset name. The example below sets theatime property to off for tank/home. Only one property can be set/modified per zfs set invocation.
Numeric properties can be specified using the following human-readable suffixes (in order of magnitude) BKMGTPEZ. Any of these suffixes can be followed by an optional b, indicating bytes, with the exception of the B suffix which already indicates bytes. The following four invocations of zfs set are equivalent numeric expressions indicating that the quota property should be set to the value of 50 gigabytes on the tank/home/marks filesystem.
Non-numeric properties are case sensitive and must be lower case, with the exception of mountpoint and sharenfs which may have mixed upper and lower case letters. 5.4.2 Inheriting PropertiesAll settable properties, with the exception of quotas and reservations, inherit their value from their parent, unless explicitly set by the child. If no ancestor has an explicit value set for an inherited property, the default value for the property is used. The zfs inherit command is used to clear a property setting, thus causing the setting to be inherited from the parent. The following example useszfs set to turn on compression, and then zfs inherit to unset the compression property, thus causing it to inherit the default setting of off. Note, since neither home nor pool have the compression property locally set (via zfs set), the default value is used. If both had it set, the value set in the most immediate ancestor would be used (home in this example).
The inherit subcommand is applied recursively when the -r option is specified. The following example causes the value for the compression property to be inherited by tank/home and any descendants it may have.
Be aware that the use of the -r option clears the current property setting for all descendant datasets. | |||||||||||||||||
| |||||||||||||||||