Debian Codegraph @

upstream/debian-trixie/man5/systemd.swap.5

raw
1 '\" t
2 .TH "SYSTEMD\&.SWAP" "5" "" "systemd 257.13" "systemd.swap"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd.swap \- Swap unit configuration
24 .SH "SYNOPSIS"
25 .PP
26 \fIswap\fR\&.swap
27 .SH "DESCRIPTION"
28 .PP
29 A unit configuration file whose name ends in
30 "\&.swap"
31 encodes information about a swap device or file for memory paging controlled and supervised by systemd\&.
32 .PP
33 This man page lists the configuration options specific to this unit type\&. See
34 \fBsystemd.unit\fR(5)
35 for the common options of all unit configuration files\&. The common configuration items are configured in the generic [Unit] and [Install] sections\&. The swap specific configuration options are configured in the [Swap] section\&.
36 .PP
37 Additional options are listed in
38 \fBsystemd.exec\fR(5), which define the execution environment the
39 \fBswapon\fR(8)
40 program is executed in, in
41 \fBsystemd.kill\fR(5), which define the way these processes are terminated, and in
42 \fBsystemd.resource-control\fR(5), which configure resource control settings for these processes of the unit\&.
43 .PP
44 Swap units must be named after the devices or files they control\&. Example: the swap device
45 /dev/sda5
46 must be configured in a unit file
47 dev\-sda5\&.swap\&. For details about the escaping logic used to convert a file system path to a unit name, see
48 \fBsystemd.unit\fR(5)\&. Note that swap units cannot be templated, nor is possible to add multiple names to a swap unit by creating additional symlinks to it\&.
49 .PP
50 Note that swap support on Linux is privileged, swap units are hence only available in the system service manager (and root\*(Aqs user service manager), but not in unprivileged user\*(Aqs service manager\&.
51 .SH "AUTOMATIC DEPENDENCIES"
52 .SS "Implicit Dependencies"
53 .PP
54 The following dependencies are implicitly added:
55 .sp
56 .RS 4
57 .ie n \{\
58 \h'-04'\(bu\h'+03'\c
59 .\}
60 .el \{\
61 .sp -1
62 .IP \(bu 2.3
63 .\}
64 All swap units automatically get the
65 \fIRequires=\fR
66 and
67 \fIAfter=\fR
68 dependencies on the device units or the mount units of the files they are activated from\&.
69 .RE
70 .PP
71 Additional implicit dependencies may be added as result of execution and resource control parameters as documented in
72 \fBsystemd.exec\fR(5)
73 and
74 \fBsystemd.resource-control\fR(5)\&.
75 .SS "Default Dependencies"
76 .PP
77 The following dependencies are added unless
78 \fIDefaultDependencies=no\fR
79 is set:
80 .sp
81 .RS 4
82 .ie n \{\
83 \h'-04'\(bu\h'+03'\c
84 .\}
85 .el \{\
86 .sp -1
87 .IP \(bu 2.3
88 .\}
89 Swap units automatically acquire a
90 \fIConflicts=\fR
91 and a
92 \fIBefore=\fR
93 dependency on
94 umount\&.target
95 so that they are deactivated at shutdown as well as a
96 \fIBefore=swap\&.target\fR
97 dependency\&.
98 .RE
99 .SH "FSTAB"
100 .PP
101 Swap units may either be configured via unit files, or via
102 /etc/fstab
103 (see
104 \fBfstab\fR(5)
105 for details)\&. Swaps listed in
106 /etc/fstab
107 will be converted into native units dynamically at boot and when the configuration of the system manager is reloaded\&. See
108 \fBsystemd-fstab-generator\fR(8)
109 for details about the conversion\&.
110 .PP
111 If a swap device or file is configured in both
112 /etc/fstab
113 and a unit file, the configuration in the latter takes precedence\&.
114 .PP
115 When reading
116 /etc/fstab, a few special options are understood by systemd which influence how dependencies are created for swap units\&.
117 .PP
118 \fBnoauto\fR, \fBauto\fR
119 .RS 4
120 With
121 \fBnoauto\fR, the swap unit will not be added as a dependency for
122 swap\&.target\&. This means that it will not be activated automatically during boot, unless it is pulled in by some other unit\&. The
123 \fBauto\fR
124 option has the opposite meaning and is the default\&.
125 .sp
126 Added in version 218\&.
127 .RE
128 .PP
129 \fBnofail\fR
130 .RS 4
131 With
132 \fBnofail\fR, the swap unit will be only wanted, not required by
133 swap\&.target\&. This means that the boot will continue even if this swap device is not activated successfully\&.
134 .sp
135 Added in version 218\&.
136 .RE
137 .PP
138 \fBx\-systemd\&.device\-timeout=\fR
139 .RS 4
140 Configure how long systemd should wait for a device to show up before giving up on an entry from
141 /etc/fstab\&. Specify a time in seconds or explicitly append a unit such as
142 "s",
143 "min",
144 "h",
145 "ms"\&.
146 .sp
147 Note that this option can only be used in
148 /etc/fstab, and will be ignored when part of the
149 \fIOptions=\fR
150 setting in a unit file\&.
151 .sp
152 Added in version 215\&.
153 .RE
154 .PP
155 \fBx\-systemd\&.makefs\fR
156 .RS 4
157 The swap structure will be initialized on the device\&. If the device is not "empty", i\&.e\&. it contains any signature, the operation will be skipped\&. It is hence expected that this option remains set even after the device has been initialized\&.
158 .sp
159 Note that this option can only be used in
160 /etc/fstab, and will be ignored when part of the
161 \fIOptions=\fR
162 setting in a unit file\&.
163 .sp
164 See
165 \[email protected]\fR(8)
166 and the discussion of
167 \fBwipefs\fR(8)
168 in
169 \fBsystemd.mount\fR(5)\&.
170 .sp
171 Added in version 240\&.
172 .RE
173 .SH "OPTIONS"
174 .PP
175 Swap unit files may include [Unit] and [Install] sections, which are described in
176 \fBsystemd.unit\fR(5)\&.
177 .PP
178 Swap unit files must include a [Swap] section, which carries information about the swap device it supervises\&. A number of options that may be used in this section are shared with other unit types\&. These options are documented in
179 \fBsystemd.exec\fR(5),
180 \fBsystemd.kill\fR(5)
181 and
182 \fBsystemd.resource-control\fR(5)\&. The options specific to the [Swap] section of swap units are the following:
183 .PP
184 \fIWhat=\fR
185 .RS 4
186 Takes an absolute path or a fstab\-style identifier of a device node or file to use for paging\&. See
187 \fBswapon\fR(8)
188 for details\&. If this refers to a device node, a dependency on the respective device unit is automatically created\&. (See
189 \fBsystemd.device\fR(5)
190 for more information\&.) If this refers to a file, a dependency on the respective mount unit is automatically created\&. (See
191 \fBsystemd.mount\fR(5)
192 for more information\&.) This option is mandatory\&. Note that the usual specifier expansion is applied to this setting, literal percent characters should hence be written as
193 "%%"\&.
194 .RE
195 .PP
196 \fIPriority=\fR
197 .RS 4
198 Swap priority to use when activating the swap device or file\&. This takes an integer\&. This setting is optional and ignored when the priority is set by
199 \fBpri=\fR
200 in the
201 \fIOptions=\fR
202 key\&.
203 .RE
204 .PP
205 \fIOptions=\fR
206 .RS 4
207 May contain an option string for the swap device\&. This may be used for controlling discard options among other functionality, if the swap backing device supports the discard or trim operation\&. (See
208 \fBswapon\fR(8)
209 for more information\&.) Note that the usual specifier expansion is applied to this setting, literal percent characters should hence be written as
210 "%%"\&.
211 .sp
212 Added in version 217\&.
213 .RE
214 .PP
215 \fITimeoutSec=\fR
216 .RS 4
217 Configures the time to wait for the swapon command to finish\&. If a command does not exit within the configured time, the swap will be considered failed and be shut down again\&. All commands still running will be terminated forcibly via
218 \fBSIGTERM\fR, and after another delay of this time with
219 \fBSIGKILL\fR\&. (See
220 \fBKillMode=\fR
221 in
222 \fBsystemd.kill\fR(5)\&.) Takes a unit\-less value in seconds, or a time span value such as "5min 20s"\&. Pass
223 "0"
224 to disable the timeout logic\&. Defaults to
225 \fIDefaultTimeoutStartSec=\fR
226 from the manager configuration file (see
227 \fBsystemd-system.conf\fR(5))\&.
228 .RE
229 .PP
230 Check
231 \fBsystemd.unit\fR(5),
232 \fBsystemd.exec\fR(5), and
233 \fBsystemd.kill\fR(5)
234 for more settings\&.
235 .SH "SEE ALSO"
236 .PP
237 \fBsystemd\fR(1), \fBsystemctl\fR(1), \fBsystemd-system.conf\fR(5), \fBsystemd.unit\fR(5), \fBsystemd.exec\fR(5), \fBsystemd.kill\fR(5), \fBsystemd.resource-control\fR(5), \fBsystemd.device\fR(5), \fBsystemd.mount\fR(5), \fBswapon\fR(8), \fBsystemd-fstab-generator\fR(8), \fBsystemd.directives\fR(7)