Skip to content
Snippets Groups Projects
zram.rst 14.37 KiB

zram: Compressed RAM-based block devices

Introduction

The zram module creates RAM-based block devices named /dev/zram<id> (<id> = 0, 1, ...). Pages written to these disks are compressed and stored in memory itself. These disks allow very fast I/O and compression provides good amounts of memory savings. Some of the use cases include /tmp storage, use as swap disks, various caches under /var and maybe many more. :)

Statistics for individual zram devices are exported through sysfs nodes at /sys/block/zram<id>/

Usage

There are several ways to configure and manage zram device(-s):

  1. using zram and zram_control sysfs attributes
  2. using zramctl utility, provided by util-linux (util-linux@vger.kernel.org).

In this document we will describe only 'manual' zram configuration steps, IOW, zram and zram_control sysfs attributes.