Linux "zramctl" Command Line Options and Examples
set up and control zram devices

zramctl is used to quickly set up zram device parameters, to reset zram devices, and to query the status of used zram devices. If no option is given, all non-zero size zram devices are shown..


Usage:

Get info:




Command Line Options:

-a
Set the compression algorithm to be used for compressing data in the zram device.
zramctl -a ...
-f
Find the first unused zram device. If a --size argument is present, then initialize the device.
zramctl -f ...
-n
Do not print a header line in status output.
zramctl -n ...
-o
Define the status output columns to be used. If no output arrangement is specified, then a default setis used. Use --help to get a list of all supported columns.
zramctl -o ...
--raw
Use the raw format for status output.
zramctl --raw ...
-r
Reset the options of the specified zram device(s). Zram device settings can be changed only after areset.
zramctl -r ...
-s
Create a zram device of the specified size. Zram devices are aligned to memory pages; when therequested size is not a multiple of the page size, it will be rounded up to the next multiple. Whennot otherwise specified, the unit of the size parameter is bytes.The size argument may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and soon for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB")or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
zramctl -s ...
-t
Set the maximum number of compression streams that can be used for the device. The default is onestream.
zramctl -t ...
-V
Display version information and exit.
zramctl -V ...
-h
Display help text and exit.RETURN VALUEzramctl returns 0 on success, nonzero on failure.FILES/dev/zram[0..N]zram block devicesEXAMPLEThe following commands set up a zram device with a size of one gigabyte and use it as swap device.# zramctl --find --size 1024M/dev/zram0# mkswap /dev/zram0# swapon /dev/zram0...# swapoff /dev/zram0# zramctl --reset /dev/zram0
zramctl -h ...