systemd.swap.xml revision 12b42c76672a66c2d4ea7212c14f8f1b5a62b78d
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 This file is part of systemd.
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering Copyright 2010 Lennart 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 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 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/>.
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering <refentryinfo>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </authorgroup>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <refentrytitle>systemd.swap</refentrytitle>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <refpurpose>Swap unit configuration</refpurpose>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <refsynopsisdiv>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <para><filename><replaceable>swap</replaceable>.swap</filename></para>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </refsynopsisdiv>
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>
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>
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 <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
0d0f0c50d3a1d90f03972a6abb82e6413daaa583Shawn Landden <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
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 <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 <title><filename>fstab</filename></title>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <para>Swap units may either be configured via unit files, or via
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>
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 <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 <varlistentry>
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 </varlistentry>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <varlistentry>
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>
76ef789d264f9eb7d7624b994aa6eead1dacfac4Lennart Poettering </varlistentry>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering </variablelist>
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 <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>
755a02c6800246e7e293897d0594fe7e7531ba59Lennart Poettering <varlistentry>
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>
<citerefentry project='man-pages'><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
<citerefentry><refentrytitle>systemd.resource-control</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>