ZRAM-INIT(8)
π¦ ZRAM-INIT π¦
okay so welcome to zram-init(8) β section 8 of the manual, system administration territory, and honestly? this page ate. it's a script that makes compressed swap devices and ramdisks happen with zram, and you're gonna understand every single flag by the end. no cap. π
π NAME π
zram-init β scripts to support compressed swap devices or ramdisks with zram. that's it, that's the whole vibe. π«Ά
β¨ SYNOPSIS β¨
zram-init [options] SIZE|write [DIR]
πΈ DESCRIPTION πΈ
So what this actually does: it prepares a zram device and then uses it as swap (or mounts it under DIR β your call, bestie). SIZE is the maximal size in megabytes. And if you wanna umount/free that zram device? You set SIZE=0. that's the off switch, periodt. π
When you use write β or literally anything else that starts with w β an idle writeback is forced. heads up tho: that only makes sense if you previously initialized with -w or -W LIMIT. otherwise it's giving nothing. π
Now the fun part: if DIR is -, then only a filesystem is created in /dev/zramDEV (or the device gets removed if SIZE is 0), but it is not mounted. and yes, that means options -o, -c, -m, -T take no effect in this case β of course they don't, you literally didn't mount anything. π
Why would you even want that? the manual says the latter can be useful e.g. for btrfs if multiple devices should be mounted jointly afterwards. very main character energy of btrfs ngl. π₯
π OPTIONS π
first rule of options club: an empty argument means the same as if the option is not specified. so don't stress if something comes through blank. π
-d DEVβ use zram device/dev/zramDEV. default is0, so/dev/zram0. make sure to use the matching value for unmounting (SIZE=0) β seriously, keep track of which device you grabbed. π-D NUMβ ifmodprobeneeds to be used, requireNUMdevices. and the manual is very clear here: this is not recommended. instead rely on/etc/modprobe.d/zram.confwith the lineoptions zram num_devices=NUM. do it the good way, bestie. β-s NUMβ use up toNUMparallel compression streams for the device. go parallel, go fast. π¨-S MAXβ use maximallyMAXmegabytes of uncompressed memory for the device. memory budget: set. π-b DEVβ useDEVas the backing device. π¦-Iβ if combined with-b DEV, store incompressible pages to the backing device. the stubborn pages get evicted β¨-wβ if combined with-b DEV, enable idle writeback to the backing device. π-W LIMITβ same as-w, but additionally setwriteback_limittoLIMIT * 4kB. math! π§-a 842|deflate|lz4|lz4hc|lzo|zstdβ set the compression algorithm used for compressing data in the zram device. pick your fighter. π₯-c OWNERβ chown toOWNER(orOWNER:GROUP) after mounting. π-m MODEβ chmod DIR toMODEafter mounting. π-o OPTSβ mount DIR with-o OPTS. π«Ά-p PRIOβ use priorityPRIOfor the swap device. default is16383. and if you want to keep the default priority (-1), usePRIO=-. π-t ext2|ext4|btrfs|xfsβ set the filesystem type if DIR is specified. default isext4. πΈ-B BSIZEβ override default blocksize (ext2,ext4). valid values are1024,2048,4096. only those three, don't get creative. π-i IRATIOβ override default bytes/inodes in fs (ext2,ext4). π¦-N INODESβ override inode count (ext2,ext4). π-L LABELβ specify the labelLABELfor the new filesystem. name her. π-U UUIDβ specify the uuidUUIDfor the new filesystem. π-Tβ do not use the discard (TRIM) feature ofext4/swap. use this option withlinux-3.14or earlier, or when you want a slight speed increase at the cost of possibly wasting a lot of memory. like, a lot of memory. you've been warned, bestie π-lβ do not usezramctleven if it's available. π§-kβ do not attempt to umount/free a previously used zram under this device. leave it be. β
π the push.sh era π
if you have push.sh in $PATH, you can also use the following options accumulatively β stack 'em, layer 'em, go off:
-K ARGβ passARGto the respectivemkswapormkfs.*call. β-M ARGβ passARGto the respectiveswapon/mountcall. π₯-2 ARGβ passARGto thetune2fscall (ignored unless forext2orext4). π-Z ARGβ passARGto thezramctlcall. π
tiny but mighty: call with LANG=C to disable translations. iykyk πΈ
π«Ά AUTHORS π«Ά
Martin VΓ€th <martin at mvath.de> β developer, current maintainer. thank you for your service, king π
π SEE ALSO π
The zram-init homepage https://github.com/vaeth/zram-init providesβ¦ (the source sentence kinda trails off in the original, but the link is the link, bestie β go click it π)
aaaand that's the page!! this was zram-init, the July 2020 edition, brought to you by section 8 of the manual. go compress something. slay. πβ¨π¦
π¦ where this page comes from
- alpine 3.24: zram-init-doc 13.0.1-r2 Β· GPL-2.0-only
- π the page's license: GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms