90 lines
4.2 KiB
Groff
90 lines
4.2 KiB
Groff
|
.\" generated with Ronn/v0.7.3
|
||
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||
|
.
|
||
|
.TH "ZRAM\-GENERATOR" "8" "November 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 file system\.
|
||
|
.
|
||
|
.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\-zram\-setup@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\-zram\-setup@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)\.
|
||
|
.
|
||
|
.SS "Applying config changes"
|
||
|
This generator is invoked in early boot, and the devices it configures will be created very early too, so the easiest way to apply config changes is to simply reboot the machine\.
|
||
|
.
|
||
|
.P
|
||
|
Nevertheless, sometimes it may be useful to add new devices or apply config changes at runtime\. Applying new configuration means restarting the units, and that in turn means recreating the zram devices\. This means that \fIfile systems are temporarily unmounted and their contents lost\fR, and \fIpages are moved out of the compressed swap device\fR into other memory\. If this is acceptable, \fBsystemctl restart systemd\-zram\-setup@zramN\fR or \fBsystemctl restart systemd\-zram\-setup@*\fR may be used to recreate a specific device or all configured devices\. (If the device didn\'t exist, \fBrestart\fR will create it\.) If the way the device is used (e\.g\. the mount point or file system type) is changed, \fBsystemctl daemon\-reload\fR needs to be called first to recreate systemd units\. If a device or mount point is removed from configuration, the unit should be stopped before calling \fBdaemon\-reload\fR\. Otherwise, systemd will not know how to stop the unit properly\.
|
||
|
.
|
||
|
.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
|