From 68f2a57c0d222692e26182466b796b4578265cfb Mon Sep 17 00:00:00 2001 From: Bousqi Date: Sat, 4 Feb 2017 16:01:32 +0100 Subject: [PATCH 1/4] removed After keyword. Creates a loop in systemd dependencies --- mkzram.service | 1 - 1 file changed, 1 deletion(-) diff --git a/mkzram.service b/mkzram.service index 340b877..a0b1ae0 100644 --- a/mkzram.service +++ b/mkzram.service @@ -1,6 +1,5 @@ [Unit] Description=Enable compressed swap in memory using zram -After=multi-user.target [Service] RemainAfterExit=yes From 3bac2f0d4f2dd201d7c8e954fc76997ababaad71 Mon Sep 17 00:00:00 2001 From: Bousqi Date: Sat, 4 Feb 2017 16:04:46 +0100 Subject: [PATCH 2/4] renamed config file to zram.conf --- zram => zram.conf | 0 zramstart | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename zram => zram.conf (100%) diff --git a/zram b/zram.conf similarity index 100% rename from zram rename to zram.conf diff --git a/zramstart b/zramstart index ce549fb..7df12d9 100755 --- a/zramstart +++ b/zramstart @@ -5,7 +5,7 @@ num_cpus=$(nproc) last_cpu=$((num_cpus - 1)) FACTOR=33 -[ -f /etc/sysconfig/zram ] && source /etc/sysconfig/zram || true +[ -f /etc/zram.conf ] && source /etc/zram.conf || true factor=$FACTOR # percentage memtotal=$(grep MemTotal /proc/meminfo | awk ' { print $2 } ') From 3729fe5174698fd3a75c5862e9c9da818f1964e0 Mon Sep 17 00:00:00 2001 From: Bousqi Date: Sat, 4 Feb 2017 16:05:07 +0100 Subject: [PATCH 3/4] Human readable stats on current usage of ZRAM --- zramstat | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zramstat b/zramstat index 66274c0..cbf8ce9 100755 --- a/zramstat +++ b/zramstat @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ls /sys/block/zram* > /dev/null 2>&1 || exit 0 @@ -9,5 +9,10 @@ for i in /sys/block/zram*; do if [ $compr -gt 0 ]; then ratio=$(echo "scale=2; $orig*100/$compr" | bc -q) fi - echo -e "/dev/${i/*\/}:\t$ratio% ($orig -> $compr)" +# echo -e "/dev/${i/*\/}:\t$ratio% ($orig -> $compr)" + echo -n -e "/dev/${i/*\/}:\t$ratio% (" + echo -n $orig | sed ':a;s/\B[0-9]\{3\}\>/.&/;ta' + echo -n " -> " + echo -n $compr | sed ':a;s/\B[0-9]\{3\}\>/.&/;ta' + echo ")" done From eb9af4a63eb70665e6368c6f8fa72da434068742 Mon Sep 17 00:00:00 2001 From: Bousqi Date: Sun, 26 Feb 2017 09:32:40 +0100 Subject: [PATCH 4/4] Unable to find a non cyclic config with swap.target. Back on multi-user.target --- mkzram.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkzram.service b/mkzram.service index a0b1ae0..84e5bb0 100644 --- a/mkzram.service +++ b/mkzram.service @@ -8,4 +8,4 @@ ExecStop=/usr/sbin/zramstop Type=oneshot [Install] -WantedBy=swap.target +WantedBy=multi-user.target