systemd.swap.xml revision 12b42c76672a66c2d4ea7212c14f8f1b5a62b78d
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering<?xml version='1.0'?> <!--*-nxml-*-->
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering<!--
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering This file is part of systemd.
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering Copyright 2010 Lennart Poettering
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering systemd is free software; you can redistribute it and/or modify it
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering (at your option) any later version.
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering systemd is distributed in the hope that it will be useful, but
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering Lesser General Public License for more details.
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering-->
abad76cc4c8586bc088fec65560cf4db2e0903c2Zbigniew Jędrzejewski-Szmek
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering<refentry id="systemd.swap">
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering <refentryinfo>
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering <title>systemd.swap</title>
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering <productname>systemd</productname>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering <authorgroup>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <author>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <contrib>Developer</contrib>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <firstname>Lennart</firstname>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <surname>Poettering</surname>
d508ac0ba0c43efa8caacdd8050970efb1e30243Lennart Poettering <email>lennart@poettering.net</email>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </author>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </authorgroup>
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek </refentryinfo>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <refmeta>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <refentrytitle>systemd.swap</refentrytitle>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <manvolnum>5</manvolnum>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </refmeta>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek <refnamediv>
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek <refname>systemd.swap</refname>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <refpurpose>Swap unit configuration</refpurpose>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </refnamediv>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <refsynopsisdiv>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <para><filename><replaceable>swap</replaceable>.swap</filename></para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </refsynopsisdiv>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <refsect1>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <title>Description</title>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <para>A unit configuration file whose name ends in
9aac0b2c19c558b853da7a6d67a0929b2d44dee4Lennart Poettering <literal>.swap</literal> encodes information about a swap device
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering or file for memory paging controlled and supervised by
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering systemd.</para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
eb9da376d76b48585b3b63b4f91903b54f7abd36Lennart Poettering <para>This man page lists the configuration options specific to
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering this unit type. See
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering for the common options of all unit configuration files. The common
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering configuration items are configured in the generic [Unit] and
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering [Install] sections. The swap specific configuration options are
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering configured in the [Swap] section.</para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek <para>Additional options are listed in
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering which define the execution environment the
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <citerefentry project='man-pages'><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering binary is executed in, and in
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek which define the way the processes are terminated, and in
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering which configure resource control settings for the processes of the
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering service.</para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <para>Swap units must be named after the devices
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering or files they control. Example: the swap device
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <filename noindex='true'>/dev/sda5</filename> must be configured in a
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering unit file <filename>dev-sda5.swap</filename>. For details about
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering the escaping logic used to convert a file system path to a unit
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering name, see
0d0f0c50d3a1d90f03972a6abb82e6413daaa583Shawn Landden <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
0d0f0c50d3a1d90f03972a6abb82e6413daaa583Shawn Landden
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <para>All swap units automatically get the appropriate
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering dependencies on the devices or on the mount points of the files
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering they are activated from.</para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <para>Swap units with <varname>DefaultDependencies=</varname>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering enabled implicitly acquire a conflicting dependency to
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <filename>umount.target</filename> so that they are deactivated at
e4603df5cf80bbd7a7d51fc66fa6c60e042423bcLennart Poettering shutdown.</para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </refsect1>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <refsect1>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <title><filename>fstab</filename></title>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <para>Swap units may either be configured via unit files, or via
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <filename>/etc/fstab</filename> (see
939c173f60c4cc1e2ce8cbf014910b13c53358bbLennart Poettering <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
939c173f60c4cc1e2ce8cbf014910b13c53358bbLennart Poettering for details). Swaps listed in <filename>/etc/fstab</filename> will
939c173f60c4cc1e2ce8cbf014910b13c53358bbLennart Poettering be converted into native units dynamically at boot and when the
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering configuration of the system manager is reloaded. See
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering for details about the conversion.</para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
eb9da376d76b48585b3b63b4f91903b54f7abd36Lennart Poettering <para>If a swap device or file is configured in both
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <filename>/etc/fstab</filename> and a unit file, the configuration
eb9da376d76b48585b3b63b4f91903b54f7abd36Lennart Poettering in the latter takes precedence.</para>
eb9da376d76b48585b3b63b4f91903b54f7abd36Lennart Poettering
eb9da376d76b48585b3b63b4f91903b54f7abd36Lennart Poettering <para>When reading <filename>/etc/fstab</filename> a few special
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering options are understood by systemd which influence how dependencies
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering are created for swap units.</para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <variablelist class='fstab-options'>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <varlistentry>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <term><option>noauto</option></term>
939c173f60c4cc1e2ce8cbf014910b13c53358bbLennart Poettering <term><option>auto</option></term>
939c173f60c4cc1e2ce8cbf014910b13c53358bbLennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <listitem><para>With <option>noauto</option> the swap unit
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering will not be added as a dependency for
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <filename>swap.target</filename>. This means that it will not
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering be activated automatically during boot, unless it is pulled in
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering by some other unit. Option <option>auto</option> has the
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering opposite meaning and is the default.</para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </listitem>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </varlistentry>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <varlistentry>
939c173f60c4cc1e2ce8cbf014910b13c53358bbLennart Poettering <term><option>nofail</option></term>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <listitem><para>With <option>nofail</option> the swap unit
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering will be only wanted, not required by
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <filename>swap.target</filename>. This means that the boot
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering will continue even if this swap device is not activated
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering successfully.</para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </listitem>
76ef789d264f9eb7d7624b994aa6eead1dacfac4Lennart Poettering </varlistentry>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </variablelist>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </refsect1>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <refsect1>
03e334a1c7dc8c20c38902aa039440763acc9b17Lennart Poettering <title>Options</title>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <para>Swap files must include a [Swap] section, which carries
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering information about the swap device it supervises. A number of
939c173f60c4cc1e2ce8cbf014910b13c53358bbLennart Poettering options that may be used in this section are shared with other
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering unit types. These options are documented in
939c173f60c4cc1e2ce8cbf014910b13c53358bbLennart Poettering <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
9aac0b2c19c558b853da7a6d67a0929b2d44dee4Lennart Poettering and
9aac0b2c19c558b853da7a6d67a0929b2d44dee4Lennart Poettering <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering The options specific to the [Swap] section of swap units are the
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering following:</para>
939c173f60c4cc1e2ce8cbf014910b13c53358bbLennart Poettering
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <variablelist class='unit-directives'>
da927ba997d68401563b927f92e6e40e021a8e5cMichal Schmidt
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <varlistentry>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <term><varname>What=</varname></term>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <listitem><para>Takes an absolute path of a device node or
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering file to use for paging. See
<citerefentry project='man-pages'><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>
for details. If this refers to a device node, a dependency on
the respective device unit is automatically created. (See
<citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for more information.) If this refers to a file, a dependency
on the respective mount unit is automatically created. (See
<citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for more information.) This option is
mandatory.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>Priority=</varname></term>
<listitem><para>Swap priority to use when activating the swap
device or file. This takes an integer. This setting is
optional and ignored when priority is set by <option>pri=</option> in the
<varname>Options=</varname> option.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>Options=</varname></term>
<listitem><para>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
<citerefentry project='man-pages'><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>
for more information.) </para></listitem>
</varlistentry>
<varlistentry>
<term><varname>TimeoutSec=</varname></term>
<listitem><para>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 <constant>SIGTERM</constant>, and after another
delay of this time with <constant>SIGKILL</constant>. (See
<option>KillMode=</option> in
<citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
Takes a unit-less value in seconds, or a time span value such
as "5min 20s". Pass <literal>0</literal> to disable the
timeout logic. Defaults to
<varname>DefaultTimeoutStartSec=</varname> from the manager
configuration file (see
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
</para></listitem>
</varlistentry>
</variablelist>
<para>Check
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
and
<citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for more settings.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry project='man-pages'><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>