Skip to content

mount

Manages a filesystem’s /etc/fstab entry and its live mount state. The declaration name is the mount point. Idempotent: re-applying an unchanged declaration reports no change.

Category: Storage

States

StateMeaning
mountedThe fstab entry matches the declaration (device, fstype, opts-as-set, dump, pass) and a filesystem is currently mounted at the mount point.
presentThe fstab entry matches the declaration, with no requirement that it is currently mounted (for noauto mounts, or configure-now-mount-later).
unmountedNothing is mounted at the mount point. The fstab entry is left untouched (use absent to remove it).
absentNothing is mounted at the mount point and there is no fstab entry; Apply unmounts then removes the line.

Parameters

ParameterTypeRequiredDescription
devicestringSource device for the fstab entry, e.g. /dev/sdb1, UUID=..., LABEL=.... Required for mounted/present; rejected on unmounted/absent.
fstypestringFilesystem type, e.g. ext4, xfs, tmpfs. Required for mounted/present; rejected on unmounted/absent.
optsstringComma-separated mount options. Compared as a set, so option order is insignificant. Default: defaults.
dumpintfstab dump field (the fifth column). Default: 0.
passintfstab fsck pass field (the sixth column). Default: 0.
mkmntboolCreate the mount point directory before mounting (state mounted). Default: true.

Examples

Mount a data volume and persist it in fstab

mount:
  /data:
    state: mounted
    device: /dev/sdb1
    fstype: ext4
    opts: rw,noatime

Configure an fstab entry without mounting now

A noauto entry: written to fstab, not mounted until later.

mount:
  /backups:
    state: present
    device: UUID=xyz
    fstype: xfs
    opts: noauto

Unmount and remove an fstab entry

mount:
  /data:
    state: absent

Notes

  • Linux only: inspection via /proc/mounts, mounting/unmounting via mount(8)/umount(8).
  • device/fstype/opts/dump/pass describe the fstab entry and may only appear on mounted/present; an unmounted/absent declaration that carries them is rejected.
  • The live mount’s device is not re-verified against the declaration (the kernel resolves UUID=/LABEL= to a real device), so a live device change is not detected — only the fstab entry is.
  • Not yet supported (planned, #111): remount-on-change, crypttab/encrypted coordination, and swap-type entries (use the swap module).