]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.swap.xml
Merge pull request #288 from phomes/cgroup-util
[thirdparty/systemd.git] / man / systemd.swap.xml
CommitLineData
e0cabd4b 1<?xml version='1.0'?> <!--*-nxml-*-->
e0cabd4b 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
681eb9cf
FB
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4<!ENTITY % entities SYSTEM "custom-entities.ent" >
5%entities;
6]>
e0cabd4b
LP
7
8<!--
9 This file is part of systemd.
10
11 Copyright 2010 Lennart Poettering
12
13 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
e0cabd4b
LP
16 (at your option) any later version.
17
18 systemd is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 21 Lesser General Public License for more details.
e0cabd4b 22
5430f7f2 23 You should have received a copy of the GNU Lesser General Public License
e0cabd4b
LP
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25-->
26
27<refentry id="systemd.swap">
798d3a52
ZJS
28 <refentryinfo>
29 <title>systemd.swap</title>
30 <productname>systemd</productname>
31
32 <authorgroup>
33 <author>
34 <contrib>Developer</contrib>
35 <firstname>Lennart</firstname>
36 <surname>Poettering</surname>
37 <email>lennart@poettering.net</email>
38 </author>
39 </authorgroup>
40 </refentryinfo>
41
42 <refmeta>
43 <refentrytitle>systemd.swap</refentrytitle>
44 <manvolnum>5</manvolnum>
45 </refmeta>
46
47 <refnamediv>
48 <refname>systemd.swap</refname>
49 <refpurpose>Swap unit configuration</refpurpose>
50 </refnamediv>
51
52 <refsynopsisdiv>
53 <para><filename><replaceable>swap</replaceable>.swap</filename></para>
54 </refsynopsisdiv>
55
56 <refsect1>
57 <title>Description</title>
58
59 <para>A unit configuration file whose name ends in
60 <literal>.swap</literal> encodes information about a swap device
61 or file for memory paging controlled and supervised by
62 systemd.</para>
63
64 <para>This man page lists the configuration options specific to
65 this unit type. See
66 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
67 for the common options of all unit configuration files. The common
68 configuration items are configured in the generic [Unit] and
69 [Install] sections. The swap specific configuration options are
70 configured in the [Swap] section.</para>
71
72 <para>Additional options are listed in
73 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
74 which define the execution environment the
3ba3a79d 75 <citerefentry project='man-pages'><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
76 binary is executed in, and in
77 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
78 which define the way the processes are terminated, and in
79 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
80 which configure resource control settings for the processes of the
81 service.</para>
82
83 <para>Swap units must be named after the devices
84 or files they control. Example: the swap device
85 <filename noindex='true'>/dev/sda5</filename> must be configured in a
86 unit file <filename>dev-sda5.swap</filename>. For details about
87 the escaping logic used to convert a file system path to a unit
88 name, see
89 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
90
91 <para>All swap units automatically get the appropriate
92 dependencies on the devices or on the mount points of the files
93 they are activated from.</para>
94
95 <para>Swap units with <varname>DefaultDependencies=</varname>
96 enabled implicitly acquire a conflicting dependency to
97 <filename>umount.target</filename> so that they are deactivated at
98 shutdown.</para>
99 </refsect1>
100
101 <refsect1>
102 <title><filename>fstab</filename></title>
103
104 <para>Swap units may either be configured via unit files, or via
105 <filename>/etc/fstab</filename> (see
3ba3a79d 106 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
798d3a52
ZJS
107 for details). Swaps listed in <filename>/etc/fstab</filename> will
108 be converted into native units dynamically at boot and when the
109 configuration of the system manager is reloaded. See
110 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
111 for details about the conversion.</para>
112
113 <para>If a swap device or file is configured in both
114 <filename>/etc/fstab</filename> and a unit file, the configuration
115 in the latter takes precedence.</para>
116
117 <para>When reading <filename>/etc/fstab</filename> a few special
118 options are understood by systemd which influence how dependencies
119 are created for swap units.</para>
120
121 <variablelist class='fstab-options'>
122 <varlistentry>
123 <term><option>noauto</option></term>
124 <term><option>auto</option></term>
125
126 <listitem><para>With <option>noauto</option> the swap unit
127 will not be added as a dependency for
128 <filename>swap.target</filename>. This means that it will not
129 be activated automatically during boot, unless it is pulled in
130 by some other unit. Option <option>auto</option> has the
131 opposite meaning and is the default.</para>
132 </listitem>
133 </varlistentry>
134
135 <varlistentry>
136 <term><option>nofail</option></term>
137
138 <listitem><para>With <option>nofail</option> the swap unit
139 will be only wanted, not required by
140 <filename>swap.target</filename>. This means that the boot
141 will continue even if this swap device is not activated
142 successfully.</para>
143 </listitem>
144 </varlistentry>
145 </variablelist>
146 </refsect1>
147
148 <refsect1>
149 <title>Options</title>
150
151 <para>Swap files must include a [Swap] section, which carries
152 information about the swap device it supervises. A number of
153 options that may be used in this section are shared with other
154 unit types. These options are documented in
155 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
156 and
157 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
158 The options specific to the [Swap] section of swap units are the
159 following:</para>
160
161 <variablelist class='unit-directives'>
162
163 <varlistentry>
164 <term><varname>What=</varname></term>
165 <listitem><para>Takes an absolute path of a device node or
166 file to use for paging. See
3ba3a79d 167 <citerefentry project='man-pages'><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
168 for details. If this refers to a device node, a dependency on
169 the respective device unit is automatically created. (See
170 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
171 for more information.) If this refers to a file, a dependency
172 on the respective mount unit is automatically created. (See
173 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
174 for more information.) This option is
175 mandatory.</para></listitem>
176 </varlistentry>
177
178 <varlistentry>
179 <term><varname>Priority=</varname></term>
180
181 <listitem><para>Swap priority to use when activating the swap
182 device or file. This takes an integer. This setting is
7128df76 183 optional and ignored when priority is set by <option>pri=</option> in the
bf1d7ba7 184 <varname>Options=</varname> option.</para></listitem>
798d3a52
ZJS
185 </varlistentry>
186
187 <varlistentry>
188 <term><varname>Options=</varname></term>
189
190 <listitem><para>May contain an option string for the swap
191 device. This may be used for controlling discard options among
192 other functionality, if the swap backing device supports the
193 discard or trim operation. (See
3ba3a79d 194 <citerefentry project='man-pages'><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
195 for more information.) </para></listitem>
196 </varlistentry>
197
198 <varlistentry>
199 <term><varname>TimeoutSec=</varname></term>
200 <listitem><para>Configures the time to wait for the swapon
201 command to finish. If a command does not exit within the
202 configured time, the swap will be considered failed and be
203 shut down again. All commands still running will be terminated
204 forcibly via <constant>SIGTERM</constant>, and after another
205 delay of this time with <constant>SIGKILL</constant>. (See
206 <option>KillMode=</option> in
207 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
208 Takes a unit-less value in seconds, or a time span value such
209 as "5min 20s". Pass <literal>0</literal> to disable the
210 timeout logic. Defaults to
211 <varname>DefaultTimeoutStartSec=</varname> from the manager
212 configuration file (see
213 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
214 </para></listitem>
215 </varlistentry>
216 </variablelist>
217
218 <para>Check
219 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
220 and
221 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
222 for more settings.</para>
223 </refsect1>
224
225 <refsect1>
226 <title>See Also</title>
227 <para>
228 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
229 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
230 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
231 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
232 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
233 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
234 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
235 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3ba3a79d 236 <citerefentry project='man-pages'><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
798d3a52
ZJS
237 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
238 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
239 </para>
240 </refsect1>
e0cabd4b
LP
241
242</refentry>