1SYSTEMD.SWAP(5)                  systemd.swap                  SYSTEMD.SWAP(5)
2
3
4

NAME

6       systemd.swap - Swap unit configuration
7

SYNOPSIS

9       swap.swap
10

DESCRIPTION

12       A unit configuration file whose name ends in ".swap" encodes
13       information about a swap device or file for memory paging controlled
14       and supervised by systemd.
15
16       This man page lists the configuration options specific to this unit
17       type. See systemd.unit(5) for the common options of all unit
18       configuration files. The common configuration items are configured in
19       the generic [Unit] and [Install] sections. The swap specific
20       configuration options are configured in the [Swap] section.
21
22       Additional options are listed in systemd.exec(5), which define the
23       execution environment the swapon(8) program is executed in, in
24       systemd.kill(5), which define the way these processes are terminated,
25       and in systemd.resource-control(5), which configure resource control
26       settings for these processes of the unit.
27
28       Swap units must be named after the devices or files they control.
29       Example: the swap device /dev/sda5 must be configured in a unit file
30       dev-sda5.swap. For details about the escaping logic used to convert a
31       file system path to a unit name, see systemd.unit(5). Note that swap
32       units cannot be templated, nor is possible to add multiple names to a
33       swap unit by creating additional symlinks to it.
34
35       Note that swap support on Linux is privileged, swap units are hence
36       only available in the system service manager (and root's user service
37       manager), but not in unprivileged user's service manager.
38

AUTOMATIC DEPENDENCIES

40   Implicit Dependencies
41       The following dependencies are implicitly added:
42
43       •   All swap units automatically get the BindsTo= and After=
44           dependencies on the device units or the mount units of the files
45           they are activated from.
46
47       Additional implicit dependencies may be added as result of execution
48       and resource control parameters as documented in systemd.exec(5) and
49       systemd.resource-control(5).
50
51   Default Dependencies
52       The following dependencies are added unless DefaultDependencies=no is
53       set:
54
55       •   Swap units automatically acquire a Conflicts= and a Before=
56           dependency on umount.target so that they are deactivated at
57           shutdown as well as a Before=swap.target dependency.
58

FSTAB

60       Swap units may either be configured via unit files, or via /etc/fstab
61       (see fstab(5) for details). Swaps listed in /etc/fstab will be
62       converted into native units dynamically at boot and when the
63       configuration of the system manager is reloaded. See systemd-fstab-
64       generator(8) for details about the conversion.
65
66       If a swap device or file is configured in both /etc/fstab and a unit
67       file, the configuration in the latter takes precedence.
68
69       When reading /etc/fstab, a few special options are understood by
70       systemd which influence how dependencies are created for swap units.
71
72       noauto, auto
73           With noauto, the swap unit will not be added as a dependency for
74           swap.target. This means that it will not be activated automatically
75           during boot, unless it is pulled in by some other unit. The auto
76           option has the opposite meaning and is the default.
77
78       nofail
79           With nofail, the swap unit will be only wanted, not required by
80           swap.target. This means that the boot will continue even if this
81           swap device is not activated successfully.
82
83       x-systemd.device-timeout=
84           Configure how long systemd should wait for a device to show up
85           before giving up on an entry from /etc/fstab. Specify a time in
86           seconds or explicitly append a unit such as "s", "min", "h", "ms".
87
88           Note that this option can only be used in /etc/fstab, and will be
89           ignored when part of the Options= setting in a unit file.
90
91       x-systemd.makefs
92           The swap structure will be initialized on the device. If the device
93           is not "empty", i.e. it contains any signature, the operation will
94           be skipped. It is hence expected that this option remains set even
95           after the device has been initialized.
96
97           Note that this option can only be used in /etc/fstab, and will be
98           ignored when part of the Options= setting in a unit file.
99
100           See systemd-mkswap@.service(8) and the discussion of wipefs(8) in
101           systemd.mount(5).
102

OPTIONS

104       Swap unit files may include [Unit] and [Install] sections, which are
105       described in systemd.unit(5).
106
107       Swap unit files must include a [Swap] section, which carries
108       information about the swap device it supervises. A number of options
109       that may be used in this section are shared with other unit types.
110       These options are documented in systemd.exec(5) and systemd.kill(5).
111       The options specific to the [Swap] section of swap units are the
112       following:
113
114       What=
115           Takes an absolute path of a device node or file to use for paging.
116           See swapon(8) for details. If this refers to a device node, a
117           dependency on the respective device unit is automatically created.
118           (See systemd.device(5) for more information.) If this refers to a
119           file, a dependency on the respective mount unit is automatically
120           created. (See systemd.mount(5) for more information.) This option
121           is mandatory. Note that the usual specifier expansion is applied to
122           this setting, literal percent characters should hence be written as
123           "%%".
124
125       Priority=
126           Swap priority to use when activating the swap device or file. This
127           takes an integer. This setting is optional and ignored when the
128           priority is set by pri= in the Options= key.
129
130       Options=
131           May contain an option string for the swap device. This may be used
132           for controlling discard options among other functionality, if the
133           swap backing device supports the discard or trim operation. (See
134           swapon(8) for more information.) Note that the usual specifier
135           expansion is applied to this setting, literal percent characters
136           should hence be written as "%%".
137
138       TimeoutSec=
139           Configures the time to wait for the swapon command to finish. If a
140           command does not exit within the configured time, the swap will be
141           considered failed and be shut down again. All commands still
142           running will be terminated forcibly via SIGTERM, and after another
143           delay of this time with SIGKILL. (See KillMode= in
144           systemd.kill(5).) Takes a unit-less value in seconds, or a time
145           span value such as "5min 20s". Pass "0" to disable the timeout
146           logic. Defaults to DefaultTimeoutStartSec= from the manager
147           configuration file (see systemd-system.conf(5)).
148
149       Check systemd.unit(5), systemd.exec(5), and systemd.kill(5) for more
150       settings.
151

SEE ALSO

153       systemd(1), systemctl(1), systemd-system.conf(5), systemd.unit(5),
154       systemd.exec(5), systemd.kill(5), systemd.resource-control(5),
155       systemd.device(5), systemd.mount(5), swapon(8), systemd-fstab-
156       generator(8), systemd.directives(7)
157
158
159
160systemd 253                                                    SYSTEMD.SWAP(5)
Impressum