1ZRAM-GENERATOR(8)           System Manager's Manual          ZRAM-GENERATOR(8)
2
3
4

NAME

6       zram-generator - Systemd unit generator for zram swap devices
7

SYNOPSIS

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

DESCRIPTION

15       zram-generator is a generator that creates systemd units to format  and
16       use compressed RAM devices, either as swap or a file system.
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-zram-setup@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    sys‐
60       temd-zram-setup@zramN.service. The effect is similar  to  what  happens
61       for swap 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
68   Applying config changes
69       This generator is invoked in early boot, and the devices it  configures
70       will  be  created  very  early  too, so the easiest way to apply config
71       changes is to simply reboot the machine.
72
73       Nevertheless, sometimes it may be useful to add new  devices  or  apply
74       config  changes at runtime. Applying new configuration means restarting
75       the units, and that in turn means recreating  the  zram  devices.  This
76       means  that  file  systems are temporarily unmounted and their contents
77       lost, and pages are moved out of the compressed swap device into  other
78       memory.    If    this    is    acceptable,   systemctl   restart   sys‐
79       temd-zram-setup@zramN or systemctl restart systemd-zram-setup@* may  be
80       used  to  recreate a specific device or all configured devices. (If the
81       device didn´t exist, restart will create it.) If the way the device  is
82       used  (e.g.  the mount point or file system type) is changed, systemctl
83       daemon-reload needs to be called first to recreate systemd units. If  a
84       device or mount point is removed from configuration, the unit should be
85       stopped before calling daemon-reload. Otherwise, systemd will not  know
86       how to stop the unit properly.
87

REPORTING BUGS

89       https://github.com/systemd/zram-generator/issues
90

SEE ALSO

92       zram-generator.conf(5), systemd.generator(7), systemd.swap(5)
93
94       https://github.com/systemd/zram-generator
95
96       Linux  documentation  of  zram:  https://kernel.org/doc/html/latest/ad
97       min-guide/blockdev/zram.html
98       and the zram sysfs ABI:  https://kernel.org/doc/Documentation/ABI/test
99       ing/sysfs-block-zram
100
101
102
103zram-generator developers        November 1973               ZRAM-GENERATOR(8)
Impressum