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