1SYSTEMD.SWAP(5) systemd.swap SYSTEMD.SWAP(5)
2
3
4
6 systemd.swap - Swap unit configuration
7
9 swap.swap
10
12 A unit configuration file whose name ends in ".swap" encodes
13 information about a swap device or file for memory paging controlled
14 and supervised by systemd.
15
16 This man page lists the configuration options specific to this unit
17 type. See systemd.unit(5) for the common options of all unit
18 configuration files. The common configuration items are configured in
19 the generic [Unit] and [Install] sections. The swap specific
20 configuration options are configured in the [Swap] section.
21
22 Additional options are listed in systemd.exec(5), which define the
23 execution environment the swapon(8) binary is executed in, and in
24 systemd.kill(5), which define the way the processes are terminated, and
25 in systemd.resource-control(5), which configure resource control
26 settings for the processes of the service.
27
28 Swap units must be named after the devices or files they control.
29 Example: the swap device /dev/sda5 must be configured in a unit file
30 dev-sda5.swap. For details about the escaping logic used to convert a
31 file system path to a unit name, see systemd.unit(5).
32
33 All swap units automatically get the appropriate dependencies on the
34 devices or on the mount points of the files they are activated from.
35
36 Swap units with DefaultDependencies= enabled implicitly acquire a
37 conflicting dependency to umount.target so that they are deactivated at
38 shutdown.
39
41 Swap units may either be configured via unit files, or via /etc/fstab
42 (see fstab(5) for details). Swaps listed in /etc/fstab will be
43 converted into native units dynamically at boot and when the
44 configuration of the system manager is reloaded. See systemd-fstab-
45 generator(8) for details about the conversion.
46
47 If a swap device or file is configured in both /etc/fstab and a unit
48 file, the configuration in the latter takes precedence.
49
50 When reading /etc/fstab a few special options are understood by systemd
51 which influence how dependencies are created for swap units.
52
53 noauto, auto
54 With noauto the swap unit will not be added as a dependency for
55 swap.target. This means that it will not be activated automatically
56 during boot, unless it is pulled in by some other unit. Option auto
57 has the opposite meaning and is the default.
58
59 nofail
60 With nofail the swap unit will be only wanted, not required by
61 swap.target. This means that the boot will continue even if this
62 swap device is not activated successfully.
63
65 Swap files must include a [Swap] section, which carries information
66 about the swap device it supervises. A number of options that may be
67 used in this section are shared with other unit types. These options
68 are documented in systemd.exec(5) and systemd.kill(5). The options
69 specific to the [Swap] section of swap units are the following:
70
71 What=
72 Takes an absolute path of a device node or file to use for paging.
73 See swapon(8) for details. If this refers to a device node, a
74 dependency on the respective device unit is automatically created.
75 (See systemd.device(5) for more information.) If this refers to a
76 file, a dependency on the respective mount unit is automatically
77 created. (See systemd.mount(5) for more information.) This option
78 is mandatory.
79
80 Priority=
81 Swap priority to use when activating the swap device or file. This
82 takes an integer. This setting is optional.
83
84 Options=
85 May contain an option string for the swap device. This may be used
86 for controlling discard options among other functionality, if the
87 swap backing device supports the discard or trim operation. (See
88 swapon(8) for more information.)
89
90 TimeoutSec=
91 Configures the time to wait for the swapon command to finish. If a
92 command does not exit within the configured time, the swap will be
93 considered failed and be shut down again. All commands still
94 running will be terminated forcibly via SIGTERM, and after another
95 delay of this time with SIGKILL. (See KillMode= in
96 systemd.kill(5).) Takes a unit-less value in seconds, or a time
97 span value such as "5min 20s". Pass "0" to disable the timeout
98 logic. Defaults to DefaultTimeoutStartSec= from the manager
99 configuration file (see systemd-system.conf(5)).
100
101 Check systemd.exec(5) and systemd.kill(5) for more settings.
102
104 systemd(1), systemctl(1), systemd.unit(5), systemd.exec(5),
105 systemd.kill(5), systemd.resource-control(5), systemd.device(5),
106 systemd.mount(5), swapon(8), systemd-fstab-generator(8),
107 systemd.directives(7)
108
109
110
111systemd 219 SYSTEMD.SWAP(5)