2023-12-25 21:54:10 +01:00
|
|
|
# Zram
|
|
|
|
|
|
|
|
Because a Linux system requires swap to function properly install `zram-init`. To keep it simple, it will utilise RAM to store compressed swap.
|
|
|
|
|
|
|
|
Install it with:
|
|
|
|
|
|
|
|
```
|
|
|
|
# apk add zram-init
|
|
|
|
# rc-update add zram-init default
|
|
|
|
```
|
|
|
|
|
2024-05-11 14:03:47 +02:00
|
|
|
`zram-init` can be configured in `/etc/conf.d/zram-init`. The amount of devices and the size of zram can be changed here, for example:
|
|
|
|
|
|
|
|
```
|
|
|
|
num_devices=1
|
|
|
|
|
|
|
|
# swap - 500M
|
|
|
|
|
|
|
|
#size0=512
|
|
|
|
size0=`LC_ALL=C free -m | awk '/^mem:/{print int($2/4)}'`
|
|
|
|
```
|
|
|
|
|
|
|
|
Now the size of the swap device will be a fourth of the ram size. Reboot the computer or restart the service to check if it works.
|
2023-12-25 22:16:15 +01:00
|
|
|
|
|
|
|
Also be sure to read the [ArchWiki](https://wiki.archlinux.org/title/Zram) for more information.
|