1ZRAM-GENERATOR(8) System Manager's Manual ZRAM-GENERATOR(8)
2
3
4
6 zram-generator - Systemd unit generator for zram swap devices
7
9 /usr/lib/systemd/system-generators/zram-generator TARGET_DIR [2RGET_DIR
10 3RGET_DIR]
11 /usr/lib/systemd/system-generators/zram-generator --setup-device DEVICE
12 /usr/lib/systemd/system-generators/zram-generator --reset-device DEVICE
13
15 zram-generator is a generator that creates systemd units to format and
16 use compressed RAM devices, either as swap or a mount point.
17
18 The generator will be invoked by systemd early at boot. The generator
19 will then:
20
21 1. read configuration files from {/etc,/lib}/systemd/zram-genera‐
22 tor.conf[.d] (see zram-generator.conf(5) for details);
23
24 2. generate systemd.swap(5) and/or systemd.mount(5) units into TAR‐
25 GET_DIR and connect them to swap.target or local-fs.target as ap‐
26 propriate;
27
28 3. ensure the zram module is loaded and create the requested devices.
29
30
31
32 The generator does nothing if run inside a container (as determined by
33 systemd-detect-virt(8) --container).
34
35 The generator also understands the kernel command-line option sys‐
36 temd.zram. See zram-generator.conf(5) for details.
37
38 Setting the ZRAM_GENERATOR_ROOT environment variable makes the genera‐
39 tor run in test mode, in which case containerisation is ignored and
40 step 3 is skipped.
41 For the ramifications of ZRAM_GENERATOR_ROOT on config handling, see
42 zram-generator.conf(5).
43
44 Generated dev-zramN.swap units depend on systemd-swap-create@zramN.ser‐
45 vice, which will:
46
47 1. read configuration files from {/etc,/lib}/systemd/zram-genera‐
48 tor.conf[.d] (see zram-generator.conf(5) for details);
49
50 2. set the desired compression algorithm, if any; if the current ker‐
51 nel doesn´t understand the specified algorithm, a warning is is‐
52 sued, but execution continues;
53
54 3. set the desired blockdev size and format it as swap with sys‐
55 temd-makefs(8).
56
57
58
59 Generated path-to-mount-point.mount units depend on systemd-swap-cre‐
60 ate@zramN.service. The effect is similar to what happens for swap
61 units, but of course they are formatted with a file system.
62
63 When the unit is stopped, the zram device is reset, freeing memory and
64 allowing the device to be reused.
65
66 zram-generator implements systemd.generator(7).
67
69 <https://github.com/systemd/zram-generator/issues>
70
72 zram-generator.conf(5), systemd.generator(7), systemd.swap(5)
73
74 <https://github.com/systemd/zram-generator>
75
76 Linux documentation of zram: <https://kernel.org/doc/html/latest/ad‐
77 min-guide/blockdev/zram.html>
78 and the zram sysfs ABI: <https://kernel.org/doc/Documentation/ABI/test‐
79 ing/sysfs-block-zram>
80
81
82
83zram-generator 0.3.2 January 1970 ZRAM-GENERATOR(8)