2017-02-22 17:29:49 +00:00
---
title: About the zfs_dataset Resource
2018-02-16 00:28:15 +00:00
platform: linux
2017-02-22 17:29:49 +00:00
---
# zfs_dataset
Use the `zfs_dataset` InSpec audit resource to test the ZFS datasets on FreeBSD systems.
2017-10-03 21:35:10 +00:00
<br>
2018-08-09 12:34:49 +00:00
## Availability
### Installation
This resource is distributed along with InSpec itself. You can use it automatically.
### Version
This resource first became available in v1.16.0 of InSpec.
2017-02-22 17:29:49 +00:00
## Syntax
A `zfs_dataset` resource block declares the ZFS dataset properties that should be tested:
describe zfs_dataset('dataset') do
it { should MATCHER 'value' }
end
where
* `('dataset')` is the name of the ZFS dataset (eg: `'tank/tmp'`)
* `MATCHER` is a valid matcher for this resource
* `'value'` is the value to be tested
2017-10-03 21:35:10 +00:00
<br>
2017-02-22 17:29:49 +00:00
## Examples
The following examples show how to use this InSpec audit resource.
### Test a dataset of 'tank/tmp'
describe zfs_dataset('tank/tmp') do
it { should be_mounted }
its('atime') { should eq 'on' }
its('compression') { should eq 'lz4' }
its('exec') { should eq 'off' }
its('readonly') { should eq 'off' }
its('setuid') { should eq 'off' }
end
2017-10-03 21:35:10 +00:00
<br>
## Matchers
2018-02-16 03:07:18 +00:00
This InSpec audit resource has the matchers listed below, in addition to dynamically exposing all ZFS dataset properties available (see: `man zfs` for the list of supported properties). For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
2017-10-03 21:35:10 +00:00
### be_mounted
The `be_mounted` matcher tests if the dataset is accessible from the file system:
it { should be_mounted }