]>
Commit | Line | Data |
---|---|---|
663996b3 MS |
1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>systemd.swap</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style> |
2 | a.headerlink { | |
3 | color: #c60f0f; | |
4 | font-size: 0.8em; | |
5 | padding: 0 4px 0 4px; | |
6 | text-decoration: none; | |
7 | visibility: hidden; | |
8 | } | |
9 | ||
10 | a.headerlink:hover { | |
11 | background-color: #c60f0f; | |
12 | color: white; | |
13 | } | |
14 | ||
15 | h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink { | |
16 | visibility: visible; | |
17 | } | |
18 | </style><a href="index.html">Index </a>· | |
19 | <a href="systemd.directives.html">Directives </a>· | |
20 | <a href="../python-systemd/index.html">Python </a>· | |
86f210e9 MP |
21 | |
22 | <span style="float:right">systemd 221</span><hr><div class="refentry"><a name="systemd.swap"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>systemd.swap — Swap unit configuration</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><p><code class="filename"><em class="replaceable"><code>swap</code></em>.swap</code></p></div><div class="refsect1"><a name="idm47667484672848"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p>A unit configuration file whose name ends in | |
e735f4d4 MP |
23 | "<code class="literal">.swap</code>" encodes information about a swap device |
24 | or file for memory paging controlled and supervised by | |
25 | systemd.</p><p>This man page lists the configuration options specific to | |
26 | this unit type. See | |
27 | <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a> | |
28 | for the common options of all unit configuration files. The common | |
29 | configuration items are configured in the generic [Unit] and | |
30 | [Install] sections. The swap specific configuration options are | |
31 | configured in the [Swap] section.</p><p>Additional options are listed in | |
32 | <a href="systemd.exec.html"><span class="citerefentry"><span class="refentrytitle">systemd.exec</span>(5)</span></a>, | |
33 | which define the execution environment the | |
e3bff60a | 34 | <a href="http://man7.org/linux/man-pages/man8/swapon.8.html"><span class="citerefentry"><span class="refentrytitle">swapon</span>(8)</span></a> |
e735f4d4 MP |
35 | binary is executed in, and in |
36 | <a href="systemd.kill.html"><span class="citerefentry"><span class="refentrytitle">systemd.kill</span>(5)</span></a>, | |
37 | which define the way the processes are terminated, and in | |
38 | <a href="systemd.resource-control.html"><span class="citerefentry"><span class="refentrytitle">systemd.resource-control</span>(5)</span></a>, | |
39 | which configure resource control settings for the processes of the | |
40 | service.</p><p>Swap units must be named after the devices | |
41 | or files they control. Example: the swap device | |
42 | <code class="filename">/dev/sda5</code> must be configured in a | |
43 | unit file <code class="filename">dev-sda5.swap</code>. For details about | |
44 | the escaping logic used to convert a file system path to a unit | |
45 | name, see | |
46 | <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>.</p><p>All swap units automatically get the appropriate | |
47 | dependencies on the devices or on the mount points of the files | |
48 | they are activated from.</p><p>Swap units with <code class="varname">DefaultDependencies=</code> | |
49 | enabled implicitly acquire a conflicting dependency to | |
50 | <code class="filename">umount.target</code> so that they are deactivated at | |
86f210e9 | 51 | shutdown.</p></div><div class="refsect1"><a name="idm47667487264368"></a><h2 id="fstab"><code class="filename">fstab</code><a class="headerlink" title="Permalink to this headline" href="#fstab">¶</a></h2><p>Swap units may either be configured via unit files, or via |
e735f4d4 | 52 | <code class="filename">/etc/fstab</code> (see |
e3bff60a | 53 | <a href="http://man7.org/linux/man-pages/man5/fstab.5.html"><span class="citerefentry"><span class="refentrytitle">fstab</span>(5)</span></a> |
e735f4d4 MP |
54 | for details). Swaps listed in <code class="filename">/etc/fstab</code> will |
55 | be converted into native units dynamically at boot and when the | |
56 | configuration of the system manager is reloaded. See | |
57 | <a href="systemd-fstab-generator.html"><span class="citerefentry"><span class="refentrytitle">systemd-fstab-generator</span>(8)</span></a> | |
58 | for details about the conversion.</p><p>If a swap device or file is configured in both | |
59 | <code class="filename">/etc/fstab</code> and a unit file, the configuration | |
60 | in the latter takes precedence.</p><p>When reading <code class="filename">/etc/fstab</code> a few special | |
61 | options are understood by systemd which influence how dependencies | |
62 | are created for swap units.</p><div class="variablelist"><dl class="variablelist"><dt id="noauto"><span class="term"><code class="option">noauto</code>, </span><span class="term"><code class="option">auto</code></span><a class="headerlink" title="Permalink to this term" href="#noauto">¶</a></dt><dd><p>With <code class="option">noauto</code> the swap unit | |
63 | will not be added as a dependency for | |
64 | <code class="filename">swap.target</code>. This means that it will not | |
65 | be activated automatically during boot, unless it is pulled in | |
66 | by some other unit. Option <code class="option">auto</code> has the | |
67 | opposite meaning and is the default.</p></dd><dt id="nofail"><span class="term"><code class="option">nofail</code></span><a class="headerlink" title="Permalink to this term" href="#nofail">¶</a></dt><dd><p>With <code class="option">nofail</code> the swap unit | |
68 | will be only wanted, not required by | |
69 | <code class="filename">swap.target</code>. This means that the boot | |
70 | will continue even if this swap device is not activated | |
86f210e9 | 71 | successfully.</p></dd></dl></div></div><div class="refsect1"><a name="idm47667484459632"></a><h2 id="Options">Options<a class="headerlink" title="Permalink to this headline" href="#Options">¶</a></h2><p>Swap files must include a [Swap] section, which carries |
e735f4d4 MP |
72 | information about the swap device it supervises. A number of |
73 | options that may be used in this section are shared with other | |
74 | unit types. These options are documented in | |
75 | <a href="systemd.exec.html"><span class="citerefentry"><span class="refentrytitle">systemd.exec</span>(5)</span></a> | |
76 | and | |
77 | <a href="systemd.kill.html"><span class="citerefentry"><span class="refentrytitle">systemd.kill</span>(5)</span></a>. | |
78 | The options specific to the [Swap] section of swap units are the | |
79 | following:</p><div class="variablelist"><dl class="variablelist"><dt id="What="><span class="term"><code class="varname">What=</code></span><a class="headerlink" title="Permalink to this term" href="#What=">¶</a></dt><dd><p>Takes an absolute path of a device node or | |
80 | file to use for paging. See | |
e3bff60a | 81 | <a href="http://man7.org/linux/man-pages/man8/swapon.8.html"><span class="citerefentry"><span class="refentrytitle">swapon</span>(8)</span></a> |
e735f4d4 MP |
82 | for details. If this refers to a device node, a dependency on |
83 | the respective device unit is automatically created. (See | |
84 | <a href="systemd.device.html"><span class="citerefentry"><span class="refentrytitle">systemd.device</span>(5)</span></a> | |
85 | for more information.) If this refers to a file, a dependency | |
86 | on the respective mount unit is automatically created. (See | |
87 | <a href="systemd.mount.html"><span class="citerefentry"><span class="refentrytitle">systemd.mount</span>(5)</span></a> | |
88 | for more information.) This option is | |
89 | mandatory.</p></dd><dt id="Priority="><span class="term"><code class="varname">Priority=</code></span><a class="headerlink" title="Permalink to this term" href="#Priority=">¶</a></dt><dd><p>Swap priority to use when activating the swap | |
90 | device or file. This takes an integer. This setting is | |
86f210e9 MP |
91 | optional and ignored when priority is set by <code class="option">pri=</code> in the |
92 | <code class="varname">Options=</code> option.</p></dd><dt id="Options="><span class="term"><code class="varname">Options=</code></span><a class="headerlink" title="Permalink to this term" href="#Options=">¶</a></dt><dd><p>May contain an option string for the swap | |
e735f4d4 MP |
93 | device. This may be used for controlling discard options among |
94 | other functionality, if the swap backing device supports the | |
95 | discard or trim operation. (See | |
e3bff60a | 96 | <a href="http://man7.org/linux/man-pages/man8/swapon.8.html"><span class="citerefentry"><span class="refentrytitle">swapon</span>(8)</span></a> |
e735f4d4 MP |
97 | for more information.) </p></dd><dt id="TimeoutSec="><span class="term"><code class="varname">TimeoutSec=</code></span><a class="headerlink" title="Permalink to this term" href="#TimeoutSec=">¶</a></dt><dd><p>Configures the time to wait for the swapon |
98 | command to finish. If a command does not exit within the | |
99 | configured time, the swap will be considered failed and be | |
100 | shut down again. All commands still running will be terminated | |
101 | forcibly via <code class="constant">SIGTERM</code>, and after another | |
102 | delay of this time with <code class="constant">SIGKILL</code>. (See | |
103 | <code class="option">KillMode=</code> in | |
104 | <a href="systemd.kill.html"><span class="citerefentry"><span class="refentrytitle">systemd.kill</span>(5)</span></a>.) | |
105 | Takes a unit-less value in seconds, or a time span value such | |
106 | as "5min 20s". Pass "<code class="literal">0</code>" to disable the | |
107 | timeout logic. Defaults to | |
108 | <code class="varname">DefaultTimeoutStartSec=</code> from the manager | |
109 | configuration file (see | |
110 | <a href="systemd-system.conf.html"><span class="citerefentry"><span class="refentrytitle">systemd-system.conf</span>(5)</span></a>). | |
111 | </p></dd></dl></div><p>Check | |
112 | <a href="systemd.exec.html"><span class="citerefentry"><span class="refentrytitle">systemd.exec</span>(5)</span></a> | |
113 | and | |
114 | <a href="systemd.kill.html"><span class="citerefentry"><span class="refentrytitle">systemd.kill</span>(5)</span></a> | |
86f210e9 | 115 | for more settings.</p></div><div class="refsect1"><a name="idm47667484439264"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p> |
e735f4d4 MP |
116 | <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>, |
117 | <a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>, | |
118 | <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>, | |
119 | <a href="systemd.exec.html"><span class="citerefentry"><span class="refentrytitle">systemd.exec</span>(5)</span></a>, | |
120 | <a href="systemd.kill.html"><span class="citerefentry"><span class="refentrytitle">systemd.kill</span>(5)</span></a>, | |
121 | <a href="systemd.resource-control.html"><span class="citerefentry"><span class="refentrytitle">systemd.resource-control</span>(5)</span></a>, | |
122 | <a href="systemd.device.html"><span class="citerefentry"><span class="refentrytitle">systemd.device</span>(5)</span></a>, | |
123 | <a href="systemd.mount.html"><span class="citerefentry"><span class="refentrytitle">systemd.mount</span>(5)</span></a>, | |
e3bff60a | 124 | <a href="http://man7.org/linux/man-pages/man8/swapon.8.html"><span class="citerefentry"><span class="refentrytitle">swapon</span>(8)</span></a>, |
e735f4d4 MP |
125 | <a href="systemd-fstab-generator.html"><span class="citerefentry"><span class="refentrytitle">systemd-fstab-generator</span>(8)</span></a>, |
126 | <a href="systemd.directives.html"><span class="citerefentry"><span class="refentrytitle">systemd.directives</span>(7)</span></a> | |
127 | </p></div></div></body></html> |