2016-09-22 12:43:57 +00:00
|
|
|
---
|
|
|
|
title: About the mount Resource
|
2018-02-16 00:28:15 +00:00
|
|
|
platform: linux
|
2016-09-22 12:43:57 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# mount
|
|
|
|
|
2019-04-26 18:24:29 +00:00
|
|
|
Use the `mount` Chef InSpec audit resource to test the mount points on FreeBSD and Linux systems.
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
<br>
|
|
|
|
|
2018-08-09 12:34:49 +00:00
|
|
|
## Availability
|
|
|
|
|
|
|
|
### Installation
|
|
|
|
|
2019-04-26 18:24:29 +00:00
|
|
|
This resource is distributed along with Chef InSpec itself. You can use it automatically.
|
2018-08-09 12:34:49 +00:00
|
|
|
|
|
|
|
### Version
|
|
|
|
|
|
|
|
This resource first became available in v1.0.0 of InSpec.
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
## Syntax
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
An `mount` resource block declares the synchronization settings that should be tested:
|
|
|
|
|
|
|
|
describe mount('path') do
|
|
|
|
it { should MATCHER 'value' }
|
|
|
|
end
|
|
|
|
|
|
|
|
where
|
|
|
|
|
|
|
|
* `('path')` is the path to the mounted directory
|
|
|
|
* `MATCHER` is a valid matcher for this resource
|
|
|
|
* `'value'` is the value to be tested
|
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
<br>
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
## Examples
|
|
|
|
|
2019-04-26 18:24:29 +00:00
|
|
|
The following examples show how to use this Chef InSpec audit resource.
|
2017-10-03 21:35:10 +00:00
|
|
|
|
|
|
|
### Test a the mount point on '/'
|
|
|
|
|
|
|
|
describe mount('/') do
|
|
|
|
it { should be_mounted }
|
|
|
|
its('device') { should eq '/dev/mapper/VolGroup-lv_root' }
|
|
|
|
its('type') { should eq 'ext4' }
|
|
|
|
its('options') { should eq ['rw', 'mode=620'] }
|
|
|
|
end
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
<br>
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
## Matchers
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2018-02-16 03:07:18 +00:00
|
|
|
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### be_mounted
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The `be_mounted` matcher tests if the file is accessible from the file system:
|
|
|
|
|
|
|
|
it { should be_mounted }
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### device
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The `device` matcher tests the device from the `fstab` table:
|
|
|
|
|
|
|
|
its('device') { should eq '/dev/mapper/VolGroup-lv_root' }
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### options
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The `options` matcher tests the mount options for the file system from the `fstab` table:
|
|
|
|
|
|
|
|
its('options') { should eq ['rw', 'mode=620'] }
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### type
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The `type` matcher tests the file system type:
|
|
|
|
|
|
|
|
its('type') { should eq 'ext4' }
|