Sha256: c7ad8a76b4e469200f30d611e38140ea49dedc463672a0eaa71867fe5e2e7cf1

Contents?: true

Size: 1.65 KB

Versions: 20

Compression:

Stored size: 1.65 KB

Contents

---
title: About the mount Resource
platform: linux
---

# mount

Use the `mount` InSpec audit resource to test the mount points on FreeBSD and Linux systems.

<br>

## Availability

### Installation

This resource is distributed along with InSpec itself. You can use it automatically.

### Version

This resource first became available in v1.0.0 of InSpec.

## Syntax

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

<br>

## Examples

The following examples show how to use this InSpec audit resource.

### 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

<br>

## Matchers

For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).

### be_mounted

The `be_mounted` matcher tests if the file is accessible from the file system:

    it { should be_mounted }

### device

The `device` matcher tests the device from the `fstab` table:

    its('device') { should eq  '/dev/mapper/VolGroup-lv_root' }

### options

The `options` matcher tests the mount options for the file system from the `fstab` table:

    its('options') { should eq ['rw', 'mode=620'] }

### type

The `type` matcher tests the file system type:

    its('type') { should eq  'ext4' }

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
inspec-core-2.3.10 docs/resources/mount.md.erb
inspec-2.3.10 docs/resources/mount.md.erb
inspec-core-2.3.5 docs/resources/mount.md.erb
inspec-2.3.5 docs/resources/mount.md.erb
inspec-core-2.3.4 docs/resources/mount.md.erb
inspec-2.3.4 docs/resources/mount.md.erb
inspec-core-2.2.112 docs/resources/mount.md.erb
inspec-2.2.112 docs/resources/mount.md.erb
inspec-core-2.2.102 docs/resources/mount.md.erb
inspec-2.2.102 docs/resources/mount.md.erb
inspec-core-2.2.101 docs/resources/mount.md.erb
inspec-2.2.101 docs/resources/mount.md.erb
inspec-core-2.2.78 docs/resources/mount.md.erb
inspec-2.2.78 docs/resources/mount.md.erb
inspec-core-2.2.70 docs/resources/mount.md.erb
inspec-2.2.70 docs/resources/mount.md.erb
inspec-core-2.2.64 docs/resources/mount.md.erb
inspec-2.2.64 docs/resources/mount.md.erb
inspec-core-2.2.61 docs/resources/mount.md.erb
inspec-2.2.61 docs/resources/mount.md.erb