mirror of
https://github.com/classy-giraffe/easy-arch.git
synced 2025-11-17 19:40:55 +00:00
Setting up ZRAM
This follows Fedora 34's formula for ZRAM size
This commit is contained in:
parent
ef721a691d
commit
019f3d8a9e
1 changed files with 15 additions and 0 deletions
15
easy-arch.sh
15
easy-arch.sh
|
|
@ -233,5 +233,20 @@ systemctl enable grub-btrfs.path --root=/mnt &>/dev/null
|
|||
echo "Enabling systemd-oomd."
|
||||
systemctl enable systemd-oomd --root=/mnt &>/dev/null
|
||||
|
||||
# Setting up ZRAM
|
||||
MEMSIZE=$(awk '/^Mem/ {print $2}' <(free -m))
|
||||
if [ "${MEMSIZE}" -ge "8192" ]; then
|
||||
ZRAMSIZE=8192
|
||||
else
|
||||
ZRAMSIZE=${MEMSIZE}
|
||||
fi
|
||||
|
||||
echo 'zram' > /mnt/etc/modules-load.d/zram.conf
|
||||
echo 'options zram num_devices=1' > /mnt/etc/modprobe.d/zram.conf
|
||||
echo 'KERNEL=="zram0", ATTR{disksize}="'${ZRAMSIZE}'M" RUN="/usr/bin/mkswap /dev/zram0", TAG+="systemd"' > /mnt/etc/udev/rules.d/99-zram.rules
|
||||
echo '# ZRAM' >> /mnt/etc/fstab
|
||||
echo '/dev/zram0 none swap defaults 0 0' >> /mnt/etc/fstab
|
||||
|
||||
# Finishing up
|
||||
echo "Done, you may now wish to reboot (further changes can be done by chrooting into /mnt)."
|
||||
exit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue