← 返回命令列表

Linux command

zramctl 命令

文件

涉及管道、覆盖或删除,执行前请先确认路径和参数。

常用示例

Check

lsmod | grep -i zram

Enable

sudo modprobe zram

Enable

sudo modprobe zram num_devices=2

Find

sudo zramctl -f -s 2GB -a lz4

List

sudo zramctl

说明

zramctl sets up and controls zram devices, which are compressed RAM-based block devices. Zram is useful for creating compressed swap space or temporary filesystems, improving memory efficiency. After creating a zram device with zramctl, use mkswap and swapon to use it as swap, or mkfs to create a filesystem.

参数

-f, --find
Find and initialize the next free zram device
-s, --size _size_
Set the size of the zram device
-a, --algorithm _alg_
Set compression algorithm (lz4, lzo, zstd, etc.)
-t, --streams _number_
Set number of compression streams
-r, --reset
Reset the device
-o, --output _list_
Define output columns
--raw
Raw output format
-n, --no-headings
Do not print column headings

FAQ

What is the zramctl command used for?

zramctl sets up and controls zram devices, which are compressed RAM-based block devices. Zram is useful for creating compressed swap space or temporary filesystems, improving memory efficiency. After creating a zram device with zramctl, use mkswap and swapon to use it as swap, or mkfs to create a filesystem.

How do I run a basic zramctl example?

Run `lsmod | grep -i zram` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -f, --find do in zramctl?

Find and initialize the next free zram device