Files
systemd/test/test-fstab-generator/test-18-options.fstab.expected/mnt-onfailuremulti.mount
T
nikhilnrr b7041b73cf fstab-generator: support for x-systemd.onfailure
Add support for the x-systemd.onfailure fstab option in fstab-generator.

This allows generated mount units to include the systemd OnFailure=
dependency specified through /etc/fstab.

x-systemd.onfailure= is handled by generalizing the existing
write_dependency() helper (already used for After=/Before=/Requires=/
Wants=) to take an optional unit-name suffix. When no suffix is given,
unit names are mangled without forcing a ".mount" suffix, since
OnFailure= targets are not necessarily mount units. write_on_failure()
is now a thin wrapper around write_dependency().

Example:

/dev/sda1 /data ext4 defaults,x-systemd.onfailure=emergency.target 0 2

generates:

OnFailure=emergency.target

This makes it possible to attach recovery targets or services to mount
failures directly from fstab configuration.

Add documentation and generator tests.
2026-09-22 18:48:23 +02:00

14 lines
353 B
SYSTEMD

# Automatically generated by systemd-fstab-generator
[Unit]
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
SourcePath=/etc/fstab
OnFailure=foo.service bar.service
Before=local-fs.target
After=blockdev@dev-sdx19.target
[Mount]
What=/dev/sdx19
Where=/mnt/onfailuremulti
Options=x-systemd.onfailure=foo.service,x-systemd.onfailure=bar.service