1 zram: Compressed RAM based block devices
2 ----------------------------------------
4 Project home: http://compcache.googlecode.com/
8 The zram module creates RAM based block devices named /dev/zram<id>
9 (<id> = 0, 1, ...). Pages written to these disks are compressed and stored
10 in memory itself. These disks allow very fast I/O and compression provides
11 good amounts of memory savings. Some of the usecases include /tmp storage,
12 use as swap disks, various caches under /var and maybe many more :)
14 Statistics for individual zram devices are exported through sysfs nodes at
19 Following shows a typical sequence of steps for using zram.
22 modprobe zram num_devices=4
23 This creates 4 devices: /dev/zram{0,1,2,3}
24 (num_devices parameter is optional. Default: 1)
27 Set disk size by writing the value to sysfs node 'disksize'.
28 The value can be either in bytes or you can use mem suffixes.
30 # Initialize /dev/zram0 with 50MB disksize
31 echo $((50*1024*1024)) > /sys/block/zram0/disksize
34 echo 256K > /sys/block/zram0/disksize
35 echo 512M > /sys/block/zram0/disksize
36 echo 1G > /sys/block/zram0/disksize
46 Per-device statistics are exported as various nodes under
64 Write any positive value to 'reset' sysfs node
65 echo 1 > /sys/block/zram0/reset
66 echo 1 > /sys/block/zram1/reset
68 This frees all the memory allocated for the given device and
69 resets the disksize to zero. You must set the disksize again
70 before reusing the device.
72 Please report any problems at:
73 - Mailing list: linux-mm-cc at laptop dot org
74 - Issue tracker: http://code.google.com/p/compcache/issues/list