zswap icon indicating copy to clipboard operation
zswap copied to clipboard

Bash script to setup zram swap devices

zswap

Zswap extends the amount of usable ram one has. It does this by utilizing compressed zram block devices.It is not related to the kernel zswap module!

Zswap defaults to use a single multithreaded lzo compressed half-ram swap disk Edit the following parameters in zswap.sh to configure zswap:

Parameter Usage Example
size Set the size a block device(K,M,G)
algo Set the compression algorithm (lzo
threads Set the # of threads to compress with
num_devices Set the # of swap devices from zswap

Use the following commands to control zswap:

Command Usage
zswap.sh start Start zswap
zswap.sh stop Stop zswap
zswap.sh restart Restart zswap
systemctl enable zswap Start zswap on boot using systemd
systemctl start zswap Start zswap using systemd
systemctl stop zswap Stop zswap using systemd
systemctl restart zswap Restart zswap using systemd