]>
Commit | Line | Data |
---|---|---|
e0cabd4b LP |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?> | |
3 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
4 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
5 | ||
6 | <!-- | |
7 | This file is part of systemd. | |
8 | ||
9 | Copyright 2010 Lennart Poettering | |
10 | ||
11 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
12 | under the terms of the GNU Lesser General Public License as published by |
13 | the Free Software Foundation; either version 2.1 of the License, or | |
e0cabd4b LP |
14 | (at your option) any later version. |
15 | ||
16 | systemd is distributed in the hope that it will be useful, but | |
17 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 19 | Lesser General Public License for more details. |
e0cabd4b | 20 | |
5430f7f2 | 21 | You should have received a copy of the GNU Lesser General Public License |
e0cabd4b LP |
22 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
23 | --> | |
24 | ||
25 | <refentry id="systemd.swap"> | |
26 | <refentryinfo> | |
27 | <title>systemd.swap</title> | |
28 | <productname>systemd</productname> | |
29 | ||
30 | <authorgroup> | |
31 | <author> | |
32 | <contrib>Developer</contrib> | |
33 | <firstname>Lennart</firstname> | |
34 | <surname>Poettering</surname> | |
35 | <email>lennart@poettering.net</email> | |
36 | </author> | |
37 | </authorgroup> | |
38 | </refentryinfo> | |
39 | ||
40 | <refmeta> | |
41 | <refentrytitle>systemd.swap</refentrytitle> | |
42 | <manvolnum>5</manvolnum> | |
43 | </refmeta> | |
44 | ||
45 | <refnamediv> | |
46 | <refname>systemd.swap</refname> | |
34511ca7 | 47 | <refpurpose>Swap unit configuration</refpurpose> |
e0cabd4b LP |
48 | </refnamediv> |
49 | ||
50 | <refsynopsisdiv> | |
e670b166 | 51 | <para><filename><replaceable>swap</replaceable>.swap</filename></para> |
e0cabd4b LP |
52 | </refsynopsisdiv> |
53 | ||
54 | <refsect1> | |
55 | <title>Description</title> | |
56 | ||
57 | <para>A unit configuration file whose name ends in | |
58 | <filename>.swap</filename> encodes information about a | |
59 | swap device or file for memory paging controlled and | |
60 | supervised by systemd.</para> | |
61 | ||
62 | <para>This man page lists the configuration options | |
63 | specific to this unit type. See | |
64 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
65 | for the common options of all unit configuration | |
66 | files. The common configuration items are configured | |
67 | in the generic [Unit] and [Install] sections. The swap | |
68 | specific configuration options are configured in the | |
69 | [Swap] section.</para> | |
70 | ||
4819ff03 LP |
71 | <para>Additional options are listed in |
72 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
73 | which define the execution environment the | |
74 | <citerefentry><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
75 | binary is executed in, and in | |
76 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
77 | which define the way the processes are | |
78 | terminated.</para> | |
79 | ||
f9276855 | 80 | <para>Swap units must be named after the devices |
16dad32e | 81 | or files they control. Example: the swap device |
e0cabd4b LP |
82 | <filename>/dev/sda5</filename> must be configured in a |
83 | unit file <filename>dev-sda5.swap</filename>. For | |
84 | details about the escaping logic used to convert a | |
85 | file system path to a unit name see | |
86 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> | |
f9276855 LP |
87 | |
88 | <para>All swap units automatically get the appropriate | |
16dad32e AE |
89 | dependencies on the devices or on the mount points |
90 | of the files they are activated from.</para> | |
f9276855 LP |
91 | |
92 | <para>Swap units with | |
93 | <varname>DefaultDependencies=</varname> enabled | |
94 | implicitly acquire a conflicting dependency to | |
95 | <filename>umount.target</filename> so that they are | |
96 | deactivated at shutdown.</para> | |
e0cabd4b LP |
97 | </refsect1> |
98 | ||
99 | <refsect1> | |
100 | <title><filename>fstab</filename></title> | |
101 | ||
102 | <para>Swap units may either be configured via unit | |
103 | files, or via <filename>/etc/fstab</filename> (see | |
104 | <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
059b37cc LP |
105 | for details). Swaps listed in |
106 | <filename>/etc/fstab</filename> will be converted into | |
107 | native units dynamically at boot and when the | |
108 | configuration of the system manager is | |
109 | reloaded. See | |
110 | <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
111 | for details about the conversion.</para> | |
e0cabd4b LP |
112 | |
113 | <para>If a swap device or file is configured in both | |
114 | <filename>/etc/fstab</filename> and a unit file the | |
115 | configuration in the latter takes precedence.</para> | |
f9276855 LP |
116 | |
117 | <para>Unless the <option>noauto</option> option is set | |
118 | for them all swap units configured in | |
119 | <filename>/etc/fstab</filename> are also added as | |
120 | requirements to <filename>swap.target</filename>, so | |
121 | that they are waited for and activated during | |
122 | boot.</para> | |
e0cabd4b LP |
123 | </refsect1> |
124 | ||
125 | <refsect1> | |
126 | <title>Options</title> | |
127 | ||
128 | <para>Swap files must include a [Swap] section, which | |
129 | carries information about the swap device it | |
2292707d LP |
130 | supervises. A number of options that may be used in |
131 | this section are shared with other unit types. These | |
132 | options are documented in | |
4819ff03 LP |
133 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
134 | and | |
135 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The | |
2292707d LP |
136 | options specific to the [Swap] section of swap units |
137 | are the following:</para> | |
e0cabd4b | 138 | |
ccc9a4f9 | 139 | <variablelist class='unit-directives'> |
e0cabd4b LP |
140 | |
141 | <varlistentry> | |
142 | <term><varname>What=</varname></term> | |
143 | <listitem><para>Takes an absolute path | |
144 | of a device node or file to use for | |
145 | paging. See | |
146 | <citerefentry><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
147 | for details. If this refers to a | |
b439c6ee | 148 | device node, a dependency on the |
e0cabd4b LP |
149 | respective device unit is |
150 | automatically created. (See | |
151 | <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
152 | for more information.) If this refers | |
b439c6ee | 153 | to a file, a dependency on the |
e0cabd4b LP |
154 | respective mount unit is automatically |
155 | created. (See | |
156 | <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
157 | for more information.) This option is | |
158 | mandatory.</para></listitem> | |
159 | </varlistentry> | |
160 | ||
161 | <varlistentry> | |
162 | <term><varname>Priority=</varname></term> | |
163 | ||
164 | <listitem><para>Swap priority to use | |
165 | when activating the swap device or | |
166 | file. This takes an integer. This | |
167 | setting is optional.</para></listitem> | |
168 | </varlistentry> | |
2292707d LP |
169 | |
170 | <varlistentry> | |
171 | <term><varname>TimeoutSec=</varname></term> | |
172 | <listitem><para>Configures the time to | |
173 | wait for the swapon command to | |
174 | finish. If a command does not exit | |
175 | within the configured time the swap | |
176 | will be considered failed and be shut | |
177 | down again. All commands still running | |
178 | will be terminated forcibly via | |
179 | SIGTERM, and after another delay of | |
180 | this time with SIGKILL. (See | |
4819ff03 LP |
181 | <option>KillMode=</option> in |
182 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.) | |
2292707d LP |
183 | Takes a unit-less value in seconds, or |
184 | a time span value such as "5min | |
185 | 20s". Pass 0 to disable the timeout | |
186 | logic. Defaults to | |
ecb963cc | 187 | 90s.</para></listitem> |
2292707d | 188 | </varlistentry> |
e0cabd4b | 189 | </variablelist> |
4819ff03 LP |
190 | |
191 | <para>Check | |
192 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
193 | and | |
194 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
195 | for more settings.</para> | |
e0cabd4b LP |
196 | </refsect1> |
197 | ||
198 | <refsect1> | |
199 | <title>See Also</title> | |
200 | <para> | |
f3e219a2 | 201 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
e0cabd4b LP |
202 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
203 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
2292707d | 204 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
4819ff03 | 205 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
e0cabd4b LP |
206 | <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
207 | <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
059b37cc | 208 | <citerefentry><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
9cc2c8b7 ZJS |
209 | <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
210 | <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
e0cabd4b LP |
211 | </para> |
212 | </refsect1> | |
213 | ||
214 | </refentry> |