salt.states.mount

Mounting of filesystems

Mount any type of mountable filesystem with the mounted function:

/mnt/sdb:
  mount.mounted:
    - device: /dev/sdb1
    - fstype: ext4
    - mkmnt: True
    - opts:
      - defaults

/srv/bigdata:
  mount.mounted:
    - device: UUID=066e0200-2867-4ebe-b9e6-f30026ca2314
    - fstype: xfs
    - opts: nobootwait,noatime,nodiratime,nobarrier,logbufs=8
    - dump: 0
    - pass_num: 2
    - persist: True
    - mkmnt: True
salt.states.mount.mod_watch(name, **kwargs)

The mounted watcher, called to invoke the watch command.

name
The name of the mount point
salt.states.mount.mounted(name, device, fstype, mkmnt=False, opts=None, dump=0, pass_num=0, config='/etc/fstab', persist=True, mount=True)

Verify that a device is mounted

name
The path to the location where the device is to be mounted
device
The device name, typically the device node, such as /dev/sdb1 or UUID=066e0200-2867-4ebe-b9e6-f30026ca2314 or LABEL=DATA
fstype
The filesystem type, this will be xfs, ext2/3/4 in the case of classic filesystems, and fuse in the case of fuse mounts
mkmnt
If the mount point is not present then the state will fail, set mkmnt: True to create the mount point if it is otherwise not present
opts
A list object of options or a comma delimited list
dump
The dump value to be passed into the fstab, Default is 0
pass_num
The pass value to be passed into the fstab, Default is 0
config
Set an alternative location for the fstab, Default is /etc/fstab
persist
Set if the mount should be saved in the fstab, Default is True
mount
Set if the mount should be mounted immediately, Default is True
salt.states.mount.swap(name, persist=True, config='/etc/fstab')

Activates a swap device

/root/swapfile:
  mount.swap

Note

swap does not currently support LABEL

salt.states.mount.unmounted(name, config='/etc/fstab', persist=False)

New in version 0.17.0.

Verify that a device is not mounted

name
The path to the location where the device is to be unmounted from
config
Set an alternative location for the fstab, Default is /etc/fstab
persist
Set if the mount should be purged from the fstab, Default is False