Use this when creating file systems automatically.
Filesystem Provisioning
Filesystem provisioning automation creates file systems on new volumes with mkfs, labels them, mounts them and sets ownership and permissions consistently.
1. Filesystem provisioning: create only if none exists (idempotent modules).
2. Choose type.
3. Record UUID.
4. Labels.
5. Never reformat existing data.
volume → filesystem (if absent) → UUID
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
findmnt <mountpoint>Primary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Command read-back and what it shows Verify boundary
For Storage Automation → Filesystem Provisioning, read back with findmnt <mountpoint>. Success is discriminated by the requested mount point resolves to the intended stable source with expected filesystem type/options, survives the intended persistence check and supports the bounded read/write behavior required by the consumer; failure remains when unmounted or wrong source, unexpected options/filesystem, unstable device name, persistence mismatch or correct mount state with unusable permissions/capacity. findmnt <mountpoint> shows current mount-source/type/options for that namespace, but it does not show underlying storage redundancy, future boot persistence or application-level correctness.
Step 2 Observation-driven branch and next-check logic Narrow the fault
Start Storage Automation → Filesystem Provisioning from one identified target/request/artifact and timestamp. Decision path: if mount point is not mounted, inspect device visibility and persistent configuration; if it is mounted from the wrong source/options, compare UUID/device mapping and requested policy; if source/options are correct but workload fails, inspect permissions, capacity, labels and application behavior.
Step 3 Common mistakes Narrow the fault
- Wrong file system options for the workload.
- mkfs with labels.
- Ownership and permissions.
- Idempotent checks.
mkfs.xfs /dev/<vg>/<lv>— create filesystemblkid /dev/<vg>/<lv>— UUIDansible <h> -m community.general.filesystem -a 'fstype=xfs dev=/dev/<vg>/<lv>' --check— idempotent module
ReferenceHow it works1 section · depth on demand
How it works
Storage Automation → Filesystem Provisioning owns requested mount point, backing block/logical device, filesystem identity, mount options and persistent configuration used to make the filesystem available after reboot. Filesystem provisioning allocates or selects storage, creates a filesystem when appropriate, mounts it into the namespace and usually persists a stable identifier in fstab or an equivalent systemd mount unit. Keep these adjacent boundaries separate: SAN/cloud volume attachment, multipath, LVM, encryption, permissions, SELinux and application ownership are separate things to check. A key diagnostic distinction is that a directory existing is not a mounted filesystem, and a mounted filesystem is not evidence that persistence, capacity or ownership matches the request.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
Filesystem provisioning prepares storage for use on a host: partitioning, creating volumes, making a filesystem, mounting it persistently and setting permissions. Automating it ensures identical layouts across servers and avoids mistakes such as formatting the wrong disk.
- community.general.parted: { device: /dev/sdb, number: 1, state: present }
- community.general.lvg: { vg: vg_data, pvs: /dev/sdb1 }
- community.general.lvol: { vg: vg_data, lv: lv_backups, size: 200g }
- community.general.filesystem: { fstype: xfs, dev: /dev/vg_data/lv_backups }
- ansible.posix.mount:
path: /srv/backups
src: /dev/vg_data/lv_backups
fstype: xfs
opts: defaults,nofail
state: mounted
Identify disks by stable identifiers (WWN, serial, /dev/disk/by-id) rather than /dev/sdX, which can change between boots, and guard formatting steps so they never run against a disk that already has a filesystem.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Storage Automation > Filesystem Provisioning. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.ansible.com/ansible/latest/collections/community/general/lvol_module.html · confidence 94%