.\" generated with Ronn-NG/v0.9.1
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
.TH "ZRAM\-GENERATOR" "8" "February 2021" "zram-generator developers"
.SH "NAME"
\fBzram\-generator\fR \- Systemd unit generator for zram swap devices
.SH "SYNOPSIS"
\fB/usr/lib/systemd/system\-generators/zram\-generator\fR \fBTARGET_DIR\fR [\fI2RGET_DIR\fR \fI3RGET_DIR\fR]
.br
\fB/usr/lib/systemd/system\-generators/zram\-generator\fR \-\-setup\-device \fBDEVICE\fR
.br
\fB/usr/lib/systemd/system\-generators/zram\-generator\fR \-\-reset\-device \fBDEVICE\fR
.SH "DESCRIPTION"
\fBzram\-generator\fR is a generator that creates systemd units to format and use compressed RAM devices, either as swap or a mount point\.
.P
The generator will be invoked by systemd early at boot\. The generator will then:
.IP "1." 4
read configuration files from \fI{/etc,/lib}/systemd/zram\-generator\.conf[\.d]\fR (see zram\-generator\.conf(5) for details);
.IP "2." 4
generate systemd\.swap(5) and/or systemd\.mount(5) units into \fBTARGET_DIR\fR and connect them to \fBswap\.target\fR or \fBlocal\-fs\.target\fR as appropriate;
.IP "3." 4
ensure the \fBzram\fR module is loaded and create the requested devices\.
.IP "" 0
.P
The generator does nothing if run inside a container (as determined by \fIsystemd\-detect\-virt(8) \-\-container\fR)\.
.P
The generator also understands the kernel command\-line option \fBsystemd\.zram\fR\. See zram\-generator\.conf(5) for details\.
.P
Setting the \fBZRAM_GENERATOR_ROOT\fR environment variable makes the generator run in test mode, in which case containerisation is ignored and step \fB3\fR is skipped\.
.br
For the ramifications of \fBZRAM_GENERATOR_ROOT\fR on config handling, see zram\-generator\.conf(5)\.
.P
Generated \fIdev\-zramN\.swap\fR units depend on \fBsystemd\-swap\-create@zramN\.service\fR, which will:
.IP "1." 4
read configuration files from \fI{/etc,/lib}/systemd/zram\-generator\.conf[\.d]\fR (see zram\-generator\.conf(5) for details);
.IP "2." 4
set the desired compression algorithm, if any; if the current kernel doesn\'t understand the specified algorithm, a warning is issued, but execution continues;
.IP "3." 4
set the desired blockdev size and format it as swap with \fIsystemd\-makefs(8)\fR\.
.IP "" 0
.P
Generated \fIpath\-to\-mount\-point\.mount\fR units depend on \fBsystemd\-swap\-create@zramN\.service\fR\. The effect is similar to what happens for swap units, but of course they are formatted with a file system\.
.P
When the unit is stopped, the zram device is reset, freeing memory and allowing the device to be reused\.
.P
\fBzram\-generator\fR implements systemd\.generator(7)\.
.SH "REPORTING BUGS"
<\fIhttps://github\.com/systemd/zram\-generator/issues\fR>
.SH "SEE ALSO"
zram\-generator\.conf(5), systemd\.generator(7), systemd\.swap(5)
.P
<\fIhttps://github\.com/systemd/zram\-generator\fR>
.P
Linux documentation of zram: <\fIhttps://kernel\.org/doc/html/latest/admin\-guide/blockdev/zram\.html\fR>
.br
and the zram sysfs ABI: <\fIhttps://kernel\.org/doc/Documentation/ABI/testing/sysfs\-block\-zram\fR>