1ZRAM-GENERATOR.CONF(5) ZRAM-GENERATOR.CONF(5)
2
3
4
6 zram-generator.conf - Systemd unit generator for zram swap devices
7 (configuration)
8
10 /usr/lib/systemd/zram-generator.conf
11 /usr/local/lib/systemd/zram-generator.conf
12 /etc/systemd/zram-generator.conf
13 /run/systemd/zram-generator.conf
14
15 /usr/lib/systemd/zram-generator.conf.d/*.conf
16 /usr/local/lib/systemd/zram-generator.conf.d/*.conf
17 /etc/systemd/zram-generator.conf.d/*.conf
18 /run/systemd/zram-generator.conf.d/*.conf
19
21 These files configure devices created by zram-generator(8). See sys‐
22 temd.syntax(5) for a general description of the syntax.
23
25 The default configuration doesn´t specify any devices. Consult
26 /usr/share/zram-generator/zram-generator.conf.example for an example
27 configuration file.
28
29 When packages need to customize the configuration, they can install
30 configuration snippets in /usr/lib/systemd/zram-generator.conf.d/.
31 Files in /etc/ are reserved for the local administrator, who may use
32 this logic to override the configuration files installed by vendor
33 packages. The main configuration file is read before any of the config‐
34 uration directories, and has the lowest precedence; entries in a file
35 in any configuration directory override entries in the single configu‐
36 ration file. Files in the *.conf.d/ configuration subdirectories are
37 sorted by their filename in lexicographic order, regardless of which of
38 the subdirectories they reside in. When multiple files specify the same
39 option, for options which accept just a single value, the entry in the
40 file with the lexicographically latest name takes precedence. It is
41 recommended to prefix all filenames in those subdirectories with a
42 two-digit number and a dash, to simplify the ordering of the files.
43
44 To disable a configuration file supplied by the vendor, the recommended
45 way is to place a symlink to /dev/null in the configuration directory
46 in /etc/, with the same filename as the vendor configuration file.
47
49 Each device is configured independently in its [zramN] section, where N
50 is a nonnegative integer. Other sections are ignored.
51
52 Devices with the final size of 0 will be discarded.
53
54 · host-memory-limit=
55
56 Sets the upper limit on the total usable RAM (as defined by MemTo‐
57 tal in /proc/meminfo, confer proc(5)) above which the device will
58 not be created.
59
60 This takes a nonnegative number, representing that limit in
61 megabytes, or the literal string none, which can be used to over‐
62 ride a limit set earlier.
63
64 Defaults to none.
65
66 For compatibility with earlier versions, memory-limit is allowed as
67 an alias for this option. Its use is discouraged, and administra‐
68 tors should migrate to host-memory-limit.
69
70 · zram-fraction=
71
72 Defines the scaling factor of the zram device´s size with relation
73 to the total usable RAM.
74
75 This takes a nonnegative floating-point number representing that
76 factor.
77
78 Defaults to 0.5.
79
80 · max-zram-size=
81
82 Sets the limit on the zram device´s size obtained by zram-fraction.
83
84 This takes a nonnegative number, representing that limit in
85 megabytes, or the literal string none, which can be used to over‐
86 ride a limit set earlier.
87
88 Defaults to 4096.
89
90 · compression-algorithm=
91
92 Specifies the algorithm used to compress the zram device.
93
94 This takes a literal string, representing the algorithm to use.
95 Consult /sys/block/zram0/comp_algorithm for a list of currently
96 loaded compression algorithms, but note that additional ones may be
97 loaded on demand.
98
99 If unset, none will be configured and the kernel´s default will be
100 used.
101
102
103
105 Setting ZRAM_GENERATOR_ROOT during parsing will cause /proc/meminfo to
106 be read from $ZRAM_GENERATOR_ROOT/proc/meminfo instead, and
107 {/usr/lib,/usr/local/lib,/etc,/run}/systemd/zram-generator.conf to be
108 read from $ZRAM_GENERATOR_ROOT/{/usr/lib,/usr/local/lib,/etc,/run}/sys‐
109 temd/zram-generator.conf.
110
112 The default configuration will yield the following:
113
114
115
116 zram device size [MB]
117 ^
118 │
119 4G>│ ooooooooooooo
120 │ o
121 │ o
122 │ o
123 2G>│ o
124 │ o
125 │ o
126 512M>│ o
127 0───────────────────────> total usable RAM [MB]
128 ^ ^ ^
129 1G 4G 8G
130
131
132
134 <https://github.com/systemd/zram-generator/issues>
135
137 zram-generator(8), systemd.syntax(5), proc(5)
138
139 <https://github.com/systemd/zram-generator>
140
141 Linux documentation of zram: <https://kernel.org/doc/html/lat‐
142 est/admin-guide/blockdev/zram.html>
143 and the zram sysfs ABI: <https://kernel.org/doc/Documentation/ABI/test‐
144 ing/sysfs-block-zram>
145
146
147
148zram-generator 0.2.0 June 2020 ZRAM-GENERATOR.CONF(5)