Package Details: zramswap 5-1

Git Clone URL: (read-only, click to copy)
Package Base: zramswap
Description: Sets up zram-based swap devices on boot
Upstream URL:
Licenses: GPL
Submitter: svenstaro
Maintainer: rpodgorny
Last Packager: rpodgorny
Votes: 235
Popularity: 0.147152
First Submitted: 2011-10-05 23:35 (UTC)
Last Updated: 2019-12-20 16:58 (UTC)

Required by (0)

Sources (3)

Latest Comments

1 2 3 4 5 6 .. 19 Next › Last »

TriMoon commented on 2023-01-07 09:49 (UTC)

Seems the link to my version is missing in the comments and the package still doesn't use it:

TriMoon commented on 2020-10-30 13:18 (UTC) (edited on 2020-10-30 13:23 (UTC) by TriMoon)

@rpodgorny, The script i posted as-is is using GiB as default SIZE_TYPE as mentioned, you are free to change that default into KiB either in the script source or in your config :)

PS: kB of meminfo is equal to KiB.... Also most modern desktops have memory sticks in multiple of GigaBytes nowerdays, thats why i set the default to GiB

rpodgorny commented on 2020-10-30 12:37 (UTC)

@TriMoon: cool, nice work!

i'll include that but first please get rid of the SIZE_TYPE thing. please pick a fixed unit (i'd use kB as it's used in /proc/meminfo) and stick to that. the reason being the ability to manage many systems at once without added complexity.

imagine an ansible script being run on your 100 machines ranging from raspberry-pis to fat servers and using for example MemAvailable from /proc/meminfo to set zramswap size accordingly. you surely don't want to reimplement the multiplication and stuff... :-(

TriMoon commented on 2020-10-30 12:14 (UTC) (edited on 2020-10-30 13:14 (UTC) by TriMoon)

Please update the script accordingly... I improved the script a bit and removed the dependency on grep and awk... I posted it here:

edit Replaced the source here with a link so i can keep it in one place.

rpodgorny commented on 2019-12-20 16:59 (UTC)

@mirh: added but untesed. feel free to try (and report if you encounter any problems).

mirh commented on 2019-12-20 11:00 (UTC) (edited on 2019-12-20 19:57 (UTC) by mirh)

Is it possible to include @telsch patch? Using zstd is a no-brainer nowadays.

EDIT: thank you!

sandboiii commented on 2019-07-07 10:24 (UTC)

@rpodgorny there are bashisms in zramctrl script and it basically not operable. Not everybody link /bin/sh to /bin/bash. So please either remove bashisms or use #!/bin/bash in this script, not #!/bin/sh

telsch commented on 2019-06-14 20:06 (UTC) (edited on 2019-06-14 20:25 (UTC) by telsch)

why not make compression configurable?

--- /tmp/zramctrl       2019-05-07 22:03:36.000000000 +0200
+++ /usr/lib/systemd/scripts/zramctrl   2019-06-14 22:01:00.554880553 +0200
@@ -11,6 +11,9 @@
   (( MEM_TOTAL= `cat /proc/meminfo|grep MemTotal|awk '{print $2}'` * 1024 ))
   modprobe zram
+  if [ -n "$ZRAM_COMPRESSION_ALGO" ]; then
+    echo "$ZRAM_COMPRESSION_ALGO" > /sys/block/zram0/comp_algorithm
+  fi
   echo $MEM > /sys/block/zram0/disksize
   mkswap /dev/zram0 -L zram0
   swapon -p 100 /dev/zram0

shah26842 commented on 2019-05-17 23:37 (UTC)

Why are you using /bin/sh and not /bin/bash? Not everyone have linked their sh to bash. If you are using dash for example, it will break the script.