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
| State | Meaning |
|---|---|
mounted | The fstab entry matches the declaration (device, fstype, opts-as-set, dump, pass) and a filesystem is currently mounted at the mount point. |
present | The fstab entry matches the declaration, with no requirement that it is currently mounted (for noauto mounts, or configure-now-mount-later). |
unmounted | Nothing is mounted at the mount point. The fstab entry is left untouched (use absent to remove it). |
absent | Nothing is mounted at the mount point and there is no fstab entry; Apply unmounts then removes the line. |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
device | string | Source device for the fstab entry, e.g. /dev/sdb1, UUID=..., LABEL=.... Required for mounted/present; rejected on unmounted/absent. | |
fstype | string | Filesystem type, e.g. ext4, xfs, tmpfs. Required for mounted/present; rejected on unmounted/absent. | |
opts | string | Comma-separated mount options. Compared as a set, so option order is insignificant. Default: defaults. | |
dump | int | fstab dump field (the fifth column). Default: 0. | |
pass | int | fstab fsck pass field (the sixth column). Default: 0. | |
mkmnt | bool | Create 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,noatimeConfigure 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: noautoUnmount and remove an fstab entry
mount:
/data:
state: absentNotes
- Linux only: inspection via
/proc/mounts, mounting/unmounting via mount(8)/umount(8). device/fstype/opts/dump/passdescribe the fstab entry and may only appear onmounted/present; anunmounted/absentdeclaration 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
swapmodule).