From 019f3d8a9ee6031aef52ef6b1a737c2b0d16b004 Mon Sep 17 00:00:00 2001 From: TommyTran732 <57488583+tommytran732@users.noreply.github.com> Date: Sun, 25 Jul 2021 07:55:23 +0000 Subject: [PATCH 1/2] Setting up ZRAM This follows Fedora 34's formula for ZRAM size --- easy-arch.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/easy-arch.sh b/easy-arch.sh index af8027b..1711d1b 100644 --- a/easy-arch.sh +++ b/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 From fb7a771bc7139392dca75c20bebd742a15cc2839 Mon Sep 17 00:00:00 2001 From: TommyTran732 <57488583+tommytran732@users.noreply.github.com> Date: Sun, 25 Jul 2021 08:01:09 +0000 Subject: [PATCH 2/2] Update easy-arch.sh --- easy-arch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easy-arch.sh b/easy-arch.sh index 1711d1b..a9c640e 100644 --- a/easy-arch.sh +++ b/easy-arch.sh @@ -243,7 +243,7 @@ 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 '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