# zramctl

## NAME



           zramctl - set up and control zram devices
    


## SYNOPSIS



           Get info:
               **zramctl**[options]
    
           Reset zram:
               **zramctl -r** _zramdev_...
    
           Print name of first unused zram device:
               **zramctl -f**
    
           Set up a zram device:
               **zramctl**[**-f** | _zramdev_] [**-s** _size_] [**-t** _number_] [**-a** _algorithm_]
    


## DESCRIPTION



           **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.
    
           Note that _zramdev_ node specified on command line has to already
           exist. The command **zramctl** creates a new _/dev/zram <N>_ nodes only
           when **--find** option specified. It’s possible (and common) that
           after system boot _/dev/zram <N>_ nodes are not created yet.
    


## OPTIONS



           **-a** , **--algorithm lzo** |**lz4** |**lz4hc** |**deflate** |**842** |**zstd**
               Set the compression algorithm to be used for compressing data
               in the zram device.
    
               The **list of supported algorithms could be inaccurate** as it
               depends on the current kernel configuration. A basic overview
               can be obtained by using the command "cat
               /sys/block/zram0/comp_algorithm"; however, please note that
               this list might also be incomplete. This is due to the fact
               that ZRAM utilizes the Crypto API, and if certain algorithms
               were built as modules, it becomes impossible to enumerate all
               of them.
    
           **-f** , **--find**
               Find the first unused zram device. If a **--size** argument is
               present, then initialize the device.
    
           **-n** , **--noheadings**
               Do not print a header line in status output.
    
           **-o** , **--output** _list_
               Define the status output columns to be used. If no output
               arrangement is specified, then a default set is used. Use
               **--help** to get a list of all supported columns.
    
               The default list of columns may be extended if _list_ is
               specified in the format _+list_ (e.g., **zramctl -o+COMP-RATIO**).
    
           **--output-all**
               Output all available columns.
    
           **-p** , **--algorithm-params** _parameter_...
               Specify the parameters for the selected compression algorithm.
               For example, **level=9 dict=/etc/dictionary** sets the compression
               level and pre-trained dictionary. Parameters are
               algorithm-specific.
    
           **-r** , **--reset** _zramdev_...
               Reset the specified zram device(s). The settings of a zram
               device can be changed only after a reset.
    
           **--raw**
               Use the raw format for status output.
    
           **-s** , **--size** _size_
               Create a zram device of the specified _size_. Zram devices are
               aligned to memory pages; when the requested _size_ is not a
               multiple of the page size, it will be rounded up to the next
               multiple. When not 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 so on 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.
    
           **-t** , **--streams** _number_
               Set the maximum number of compression streams that can be used
               for the device. The default is use all CPUs and one stream for
               kernels older than 4.6.
    
           **-h** , **--help**
               Display help text and exit.
    
           **-V** , **--version**
               Display version and exit.
    


## EXIT STATUS



           **zramctl** returns 0 on success, nonzero on failure.
    


## FILES



           _/dev/zram[0..N]_
               zram block devices
    


## EXAMPLE



           The 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
    


## AVAILABILITY



           The **zramctl** command is part of the util-linux package which can be
           downloaded from Linux Kernel Archive
           <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is
           part of the _util-linux_ (a random collection of Linux utilities)
           project. Information about the project can be found at 
           ⟨https://www.kernel.org/pub/linux/utils/util-linux/⟩. If you have a
           bug report for this manual page, send it to
           util-linux@vger.kernel.org. This page was obtained from the
           project's upstream Git repository
           ⟨git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git⟩ on
           2025-08-11. (At that time, the date of the most recent commit that
           was found in the repository was 2025-08-05.) If you discover any
           rendering problems in this HTML version of the page, or you
           believe there is a better or more up-to-date source for the page,
           or you have corrections or improvements to the information in this
           COLOPHON (which is _not_ part of the original manual page), send a
           mail to man-pages@man7.org
    
    util-linux 2.42-start-521-ec46  2025-08-09                     _ZRAMCTL_(8)
    


* * *