1ZRAM-GENERATOR.CONF(5)        File Formats Manual       ZRAM-GENERATOR.CONF(5)
2
3
4

NAME

6       zram-generator.conf  -  Systemd  unit  generator  for zram swap devices
7       (configuration)
8

SYNOPSIS

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

DESCRIPTION

21       These files configure devices created by  zram-generator(8).  See  sys‐
22       temd.syntax(5) for a general description of the syntax.
23

CONFIGURATION DIRECTORIES AND PRECEDENCE

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
48       The generator understands the  following  option  on  the  kernel  com‐
49       mand-line:  systemd.zram[=0|1]. When specified with a true argument (or
50       no argument), the zram0 device will be created. Default options  apply,
51       but  may be overridden by configuration on disk if present. When speci‐
52       fied with a false argument, no zram devices will be created by the gen‐
53       erator.  This  option  thus  has higher priority than the configuration
54       files.
55

OPTIONS

57       Each device is configured independently in its [zramN] section, where N
58       is a nonnegative integer. Other sections are ignored.
59
60       Devices with the final size of 0 will be discarded.
61
62host-memory-limit=
63
64           Sets  the upper limit on the total usable RAM (as defined by MemTo‐
65           tal in /proc/meminfo, confer proc(5)) above which the  device  will
66           not be created.
67
68           This  takes  a  nonnegative  number,  representing  that  limit  in
69           megabytes, or the literal string none, which can be used  to  over‐
70           ride a limit set earlier.
71
72           Defaults to none.
73
74           For compatibility with earlier versions, memory-limit is allowed as
75           an alias for this option. Its use is discouraged,  and  administra‐
76           tors should migrate to host-memory-limit.
77
78zram-fraction=
79
80           Defines  the scaling factor of the zram device´s size with relation
81           to the total usable RAM.
82
83           This takes a nonnegative floating-point  number  representing  that
84           factor.
85
86           Defaults to 0.5.
87
88max-zram-size=
89
90           Sets the limit on the zram device´s size obtained by zram-fraction.
91
92           This  takes  a  nonnegative  number,  representing  that  limit  in
93           megabytes, or the literal string none, which can be used  to  over‐
94           ride a limit set earlier.
95
96           Defaults to 4096.
97
98compression-algorithm=
99
100           Specifies the algorithm used to compress the zram device.
101
102           This takes a literal string, representing the algorithm to use.
103           Consult  /sys/block/zram0/comp_algorithm  for  a  list of currently
104           loaded compression algorithms, but note that additional ones may be
105           loaded on demand.
106
107           If  unset, none will be configured and the kernel´s default will be
108           used.
109
110swap-priority=
111
112           Controls the relative swap priority, a value between -1 and  32767.
113           Higher numbers indicate higher priority.
114
115           If unset, 100 is used.
116
117mount-point=
118
119           Format  the  device with a file system (not as swap) and mount this
120           file system over the specified directory. When neither this  option
121           nor fs-type= is specified, the device will be formatted as swap.
122
123           Note that the device is temporary: contents will be destroyed auto‐
124           matically after the file system is unmounted (to release the  back‐
125           ing memory).
126
127fs-type=
128
129           Specifies how the device shall be formatted. The default is ext2 if
130           mount-point is specified, and swap otherwise. (Effectively, the de‐
131           vice   will   be   formatted  as  swap,  if  neither  fs-type=  nor
132           mount-point= are specified.)
133
134           Note that the device is temporary: contents will be destroyed auto‐
135           matically  after the file system is unmounted (to release the back‐
136           ing memory).
137
138           Also see systemd-makefs(8).
139
140
141

ENVIRONMENT VARIABLES

143       Setting ZRAM_GENERATOR_ROOT during parsing will cause /proc/meminfo  to
144       be    read    from   $ZRAM_GENERATOR_ROOT/proc/meminfo   instead,   and
145       {/usr/lib,/usr/local/lib,/etc,/run}/systemd/zram-generator.conf  to  be
146       read from $ZRAM_GENERATOR_ROOT/{/usr/lib,/usr/local/lib,/etc,/run}/sys‐
147       temd/zram-generator.conf.
148

EXAMPLES

150       The default configuration will yield the following:
151
152
153            zram device size [MB]
154                ^
155
156             4G>│               ooooooooooooo
157                │             o
158                │           o
159                │         o
160             2G>│       o
161                │     o
162                │   o
163           512M>│ o
164                0───────────────────────> total usable RAM [MB]
165                  ^     ^       ^
166                  1G    4G      8G
167
168
169

REPORTING BUGS

171       <https://github.com/systemd/zram-generator/issues>
172

SEE ALSO

174       zram-generator(8), systemd.syntax(5), proc(5)
175
176       <https://github.com/systemd/zram-generator>
177
178       Linux documentation  of  zram:  <https://kernel.org/doc/html/latest/ad
179       min-guide/blockdev/zram.html>
180       and the zram sysfs ABI: <https://kernel.org/doc/Documentation/ABI/test
181       ing/sysfs-block-zram>
182
183
184
185zram-generator 0.3.2             January 1970           ZRAM-GENERATOR.CONF(5)
Impressum