Debian Codegraph @

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

raw
1 '\" t
2 .TH "SYSTEMD\&.SWAP" "5" "" "systemd 261~rc3" "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 Local 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 .sp
100 .RS 4
101 .ie n \{\
102 \h'-04'\(bu\h'+03'\c
103 .\}
104 .el \{\
105 .sp -1
106 .IP \(bu 2.3
107 .\}
108 Network swap units (those with
109 \fB_netdev\fR
110 in their options) automatically acquire
111 \fIAfter=\fR
112 dependencies on
113 remote\-fs\-pre\&.target
114 and
115 network\&.target, plus
116 \fIAfter=\fR
117 and
118 \fIWants=\fR
119 dependencies on
120 network\-online\&.target, and a
121 \fIBefore=\fR
122 dependency on
123 remote\-fs\&.target
124 instead of
125 swap\&.target\&.
126 .RE
127 .SH "FSTAB"
128 .PP
129 Swap units may either be configured via unit files, or via
130 /etc/fstab
131 (see
132 \fBfstab\fR(5)
133 for details)\&. Swaps listed in
134 /etc/fstab
135 will be converted into native units dynamically at boot and when the configuration of the system manager is reloaded\&. See
136 \fBsystemd-fstab-generator\fR(8)
137 for details about the conversion\&.
138 .PP
139 If a swap device or file is configured in both
140 /etc/fstab
141 and a unit file, the configuration in the latter takes precedence\&.
142 .PP
143 When reading
144 /etc/fstab, a few special options are understood by systemd which influence how dependencies are created for swap units\&.
145 .PP
146 \fBnoauto\fR, \fBauto\fR
147 .RS 4
148 With
149 \fBnoauto\fR, the swap unit will not be added as a dependency for
150 swap\&.target
151 (or
152 remote\-fs\&.target
153 for network swap devices, see
154 \fB_netdev\fR
155 below)\&. This means that it will not be activated automatically during boot, unless it is pulled in by some other unit\&. The
156 \fBauto\fR
157 option has the opposite meaning and is the default\&.
158 .sp
159 Added in version 218\&.
160 .RE
161 .PP
162 \fBnofail\fR
163 .RS 4
164 With
165 \fBnofail\fR, the swap unit will be only wanted, not required by
166 swap\&.target
167 (or
168 remote\-fs\&.target
169 for network swap devices)\&. This means that the boot will continue even if this swap device is not activated successfully\&.
170 .sp
171 Added in version 218\&.
172 .RE
173 .PP
174 \fBx\-systemd\&.device\-timeout=\fR
175 .RS 4
176 Configure how long systemd should wait for a device to show up before giving up on an entry from
177 /etc/fstab\&. Specify a time in seconds or explicitly append a unit such as
178 "s",
179 "min",
180 "h",
181 "ms"\&.
182 .sp
183 Note that this option can only be used in
184 /etc/fstab, and will be ignored when part of the
185 \fIOptions=\fR
186 setting in a unit file\&.
187 .sp
188 Added in version 215\&.
189 .RE
190 .PP
191 \fBx\-systemd\&.makefs\fR
192 .RS 4
193 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\&.
194 .sp
195 Note that this option can only be used in
196 /etc/fstab, and will be ignored when part of the
197 \fIOptions=\fR
198 setting in a unit file\&.
199 .sp
200 See
201 \[email protected]\fR(8)
202 and the discussion of
203 \fBwipefs\fR(8)
204 in
205 \fBsystemd.mount\fR(5)\&.
206 .sp
207 Added in version 240\&.
208 .RE
209 .PP
210 \fB_netdev\fR
211 .RS 4
212 Marks this swap device as requiring network access\&. This is useful for swap on network block devices (e\&.g\&. iSCSI)\&.
213 .sp
214 Network swap units are ordered between
215 remote\-fs\-pre\&.target
216 and
217 remote\-fs\&.target, instead of being ordered before
218 swap\&.target\&. They also pull in
219 network\-online\&.target
220 and are ordered after it and
221 network\&.target\&.
222 .sp
223 Added in version 261\&.
224 .RE
225 .SH "OPTIONS"
226 .PP
227 Swap unit files may include [Unit] and [Install] sections, which are described in
228 \fBsystemd.unit\fR(5)\&.
229 .PP
230 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
231 \fBsystemd.exec\fR(5),
232 \fBsystemd.kill\fR(5)
233 and
234 \fBsystemd.resource-control\fR(5)\&. The options specific to the [Swap] section of swap units are the following:
235 .PP
236 \fIWhat=\fR
237 .RS 4
238 Takes an absolute path or a fstab\-style identifier of a device node or file to use for paging\&. See
239 \fBswapon\fR(8)
240 for details\&. If this refers to a device node, a dependency on the respective device unit is automatically created\&. (See
241 \fBsystemd.device\fR(5)
242 for more information\&.) If this refers to a file, a dependency on the respective mount unit is automatically created\&. (See
243 \fBsystemd.mount\fR(5)
244 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
245 "%%"\&.
246 .RE
247 .PP
248 \fIPriority=\fR
249 .RS 4
250 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
251 \fBpri=\fR
252 in the
253 \fIOptions=\fR
254 key\&.
255 .RE
256 .PP
257 \fIOptions=\fR
258 .RS 4
259 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
260 \fBswapon\fR(8)
261 for more information\&.) Note that the usual specifier expansion is applied to this setting, literal percent characters should hence be written as
262 "%%"\&.
263 .sp
264 Added in version 217\&.
265 .RE
266 .PP
267 \fITimeoutSec=\fR
268 .RS 4
269 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
270 \fBSIGTERM\fR, and after another delay of this time with
271 \fBSIGKILL\fR\&. (See
272 \fBKillMode=\fR
273 in
274 \fBsystemd.kill\fR(5)\&.) Takes a unit\-less value in seconds, or a time span value such as "5min 20s"\&. Pass
275 "0"
276 to disable the timeout logic\&. Defaults to
277 \fIDefaultTimeoutStartSec=\fR
278 from the manager configuration file (see
279 \fBsystemd-system.conf\fR(5))\&.
280 .RE
281 .PP
282 Check
283 \fBsystemd.unit\fR(5),
284 \fBsystemd.exec\fR(5), and
285 \fBsystemd.kill\fR(5)
286 for more settings\&.
287 .SH "SEE ALSO"
288 .PP
289 \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)