Package Details: zramswap 5-1

Git Clone URL: https://aur.archlinux.org/zramswap.git (read-only, click to copy)
Package Base: zramswap
Description: Sets up zram-based swap devices on boot
Upstream URL: http://en.wikipedia.org/wiki/ZRam
Licenses: GPL
Submitter: Svenstaro
Maintainer: rpodgorny
Last Packager: rpodgorny
Votes: 235
Popularity: 1.00
First Submitted: 2011-10-05 23:35 (UTC)
Last Updated: 2019-12-20 16:58 (UTC)

Latest Comments

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: https://forum.manjaro.org/t/improved-zramswap/34767

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 ))
   (( MEM= MEM_TOTAL * $ZRAM_SIZE_PERCENT / 100 ))
   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.

rpodgorny commented on 2019-05-06 22:41 (UTC)

i've quicky hacked a new version. please try it out...

rpodgorny commented on 2019-05-06 21:51 (UTC)

thanks for all the input. i'll be leaving tomorrow for a week but i'll try to look into this before i leave. otherwise, please be patient... ...also, always patches welcome! ;-)

stuartiannaylor commented on 2019-05-06 19:37 (UTC) (edited on 2019-05-06 19:38 (UTC) by stuartiannaylor)

Still does strange things like create multiple devices when zram is multi-stream by default.

Doesn't check for existing zram services and so will overwrite.

Also omits the mem_limit cap to control actual memory usage.

Irrespective of alg its still out of date.

Freso commented on 2019-05-06 19:32 (UTC)

I mean, if it hadn’t been changed to specifically use the non-default compression algorithm, upgrading the kernel to 5.1+ would automatically have made lzo-rle what was used by default… I don’t think the script should hardcode the compression method. If people want to use lz4, they can make it do so themselves. Trust that the kernel devs make informed decisions on what compression to use by default?

papakilo commented on 2019-05-06 13:56 (UTC) (edited on 2019-05-06 14:02 (UTC) by papakilo)

@rpodgorny

I have changed your config and I'm already trying lzo-rle with kernel 5.1:

$ cat /sys/block/zram0/comp_algorithm lzo [lzo-rle] lz4 lz4hc 842 zstd

$ zramctl NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT /dev/zram1 lzo-rle 480,6M 4K 79B 12K 2 [SWAP] /dev/zram0 lzo-rle 480,6M 4K 79B 12K 2 [SWAP]

Now I'm testing if really faster than lz4...

papakilo commented on 2019-05-06 13:25 (UTC)

Hi rpodgorny,

as you asked me to advise you, Linux kernel 5.1 is finally available.

So now that lzo-rle compression is also available (https://www.phoronix.com/scan.php?page=news_item&px=ZRAM-Linux-5.1-Better-Perform), will you apply it to zramswap?

rpodgorny commented on 2019-03-15 13:47 (UTC)

bump me when 5.1 is out. also, please remove the package deletion request. thank you...

papakilo commented on 2019-03-15 08:34 (UTC) (edited on 2019-04-25 16:49 (UTC) by papakilo)

Hi there, now that lzo-rle compression will be available (https://www.phoronix.com/scan.php?page=news_item&px=ZRAM-Linux-5.1-Better-Perform), will you apply it to zramswap? Bye, thanks.

stuartiannaylor commented on 2019-03-14 13:48 (UTC) (edited on 2019-03-14 13:58 (UTC) by stuartiannaylor)

Its great that you have made a package for Arch problem is you have used zram-config-0.5.deb as a basis.

Afraid much of what you are doing like creating devices per core whilst zram is multi-stream by default is purely through the Chinese bad whispers of the above package. You use the pointless num_devices which is optional and don't check if any exist say for the likes of log2ram. Zram is a hotplug system like zramctl --find find a free device I have been on a rant to Ubuntu about how a package such as the above has passed so many release when it is practically broken in every way and somehow manages to encourage so many copies.

Read the kernel doc and you find there is little correlation. https://www.kernel.org/doc/Documentation/blockdev/zram.txt You can check my repo out which prob needs pollish but at least is relatively correct. https://github.com/StuartIanNaylor/zram-swap-config

Read the bugs and my questions on what is obviously your source. https://launchpad.net/ubuntu/+source/zram-config/+bugs

PS log2ram is also great and if your updating packages and maybe in the mood have a look at. https://github.com/StuartIanNaylor/log2ram

Needs a config script as disk_size, mem_limit and the choice of any comp alg from /proc/crypto is far to wide a choice to be hard wired.

I have noticed that there is little difference on some distribs between lzo & lz4 and thinking it might be down to binary optimisation and in many cases where this is used if NEON optimisation has been implemented in compile. lz4 should be much faster but seems in use much less than expected with raspian that is. Prob Arch haven't checked lz4 should be a clear winner.

jaab commented on 2018-04-13 10:46 (UTC)

Works like a charm for small arm devices. Thank you!

duffydack commented on 2018-03-19 00:13 (UTC) (edited on 2018-03-19 00:14 (UTC) by duffydack)

/dev/zram{0-7} lz4 199.2M 4K 68B 4K 8 [SWAP]

Excellent, thank you.

rpodgorny commented on 2018-03-18 23:56 (UTC)

updated. please test.

duffydack commented on 2018-03-18 23:35 (UTC)

Lz4 is faster apparently, also arch wiki zram example. I can set it myself, it's no biggie.

rpodgorny commented on 2018-03-18 23:09 (UTC)

i'm not forcing any particular algorithm so the default is being used. ...which seems to be lzo.

any reason why i should override the default?

duffydack commented on 2018-03-18 22:43 (UTC)

Any chance the script can set the algorithm to lz4. I can do this myself if need be, but think it's a good default to have using this PKG. Regards

rpodgorny commented on 2017-11-19 22:42 (UTC)

i don't think it's outdated. it's just a simpler version if you want zram only.

lod commented on 2017-11-19 19:31 (UTC)

Outdated approach for creating hybrid swap space. Use this instead: https://wiki.archlinux.org/index.php/swap#systemd-swap

vgivanovic commented on 2017-02-21 17:35 (UTC)

This package and zswap should be combined. (I'm leaving a similar comment aur:zwap.)

Anakon commented on 2015-10-08 11:27 (UTC)

May I suggest to use the nproc command to get cpucount instead of parsing /proc/cpuinfo ? For example on an Odroid C1 this leads to a wrong number of 5 : $ cat /proc/cpuinfo Processor : ARMv7 Processor rev 1 (v7l) processor : 0 BogoMIPS : 3.27 processor : 1 BogoMIPS : 3.27 processor : 2 BogoMIPS : 3.27 processor : 3 BogoMIPS : 3.27 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc05 CPU revision : 1 Hardware : ODROIDC Revision : 000a Serial : 1b00000000000000

bluerider commented on 2015-04-06 17:48 (UTC)

I have taken your advice and have started my own package: <https://aur.archlinux.org/packages/zswap/>

bluerider commented on 2015-04-06 01:25 (UTC)

I recommended it for replacement because it solves several things with the current zramswap script: 1) uses zramctl 2) allows the existence of zram devices beforehand 3) removes only swap zram devices when called to stop 4) suppports effcient swap reset 5) allows different parameters for each zram module. -- the +2 is to ensure there are 2 free zram devices for other purposes -- the /7 is because the output has 7 lines per zram devices when using bash.

rpodgorny commented on 2015-04-06 00:04 (UTC)

nice, and: 1) i suggest you create a separate package with the -git suffix as per https://wiki.archlinux.org/index.php/VCS_package_guidelines 2) looking at your scripts, it seems to be configured by editing the .sh file directly. this is a general no-no and should be changed to source the config from /etc. 3) just as a quality of code improvement recommendation, you should document your code more - at least the magical constants (num_devices+2, ...raw))/7, ...).

bluerider commented on 2015-04-05 20:36 (UTC)

# Contributor: ifaigios <ifaigios_at_gmail_dot_com> # Contributor: Alyssa Hung <deciare@isisiew.org> # Contributor: Matt Brennan # Contributor: falconindy # Contributor: adee # Contributor: mystilleef # Contributor: Mark Lee <mark@markelee.com> pkgname=zramswap pkgver=2 pkgrel=1 pkgdesc="Sets up zram-based swap devices on boot" arch=('any') url="https://github.com/bluerider/zramswap.git" license=('MIT') depends=('bash' 'util-linux') makedepends=('git') source=("git+$url") sha256sums=('SKIP') package() { install -Dm755 "${srcdir}/${pkgname}/zramswap.sh" "${pkgdir}/usr/lib/systemd/scripts/zramswap.sh" install -Dm644 "${srcdir}/${pkgname}/zramswap.service" "${pkgdir}/usr/lib/systemd/system/zramswap.service" }

rpodgorny commented on 2015-03-05 11:38 (UTC)

probably because zramctl was non-existent at the time this package got created... still, peeking quicky at the current solution, there doesn't seem to be much more than modprobe+mkswap+swapon which is the same as systemd-swap uses for zram. zramctl is used there only at the "stop" phase (why not in the "start"?): https://github.com/Nefelim4ag/systemd-swap/blob/master/systemd-swap.sh ...but i might be mistaken - feel free to correct me. patches are welcome and i'll be happy to merge them.

AJSlye commented on 2015-03-01 12:04 (UTC)

I agree with bluerider, zramctl is already in the Community repository as is systemd-swap. Why not just make a pkgbuild script to install, setup and use these two already existing packages.

bluerider commented on 2014-09-29 20:29 (UTC)

Is there a reason why this script doesn't just use zramctl?

Nefelim4ag commented on 2014-08-19 21:17 (UTC)

Change type unit to simple, improve system start time, and not break zramswap script. [Unit] Description=Zram-based swap (compressed RAM block devices) [Service] ExecStart=/usr/lib/systemd/scripts/zramctrl start ExecStop=/usr/lib/systemd/scripts/zramctrl stop RemainAfterExit=yes [Install] WantedBy=multi-user.target

Nefelim4ag commented on 2014-07-30 17:10 (UTC)

@beta990: only for swapping You can use it for tmp by aur/zram or by handwork script.

francoism commented on 2014-07-30 15:45 (UTC)

@nariox: Thanks for your information. :) About this package: can I use it for creating a custom location for storing (tmp) files into the memory? Or is this only for swapping?

nariox commented on 2014-07-30 15:12 (UTC)

@beta990: zram is a kernel module, you don't neet this package to use it. This package (zramswap) includes scripts to automatically enable zram on boot. To enable/use it you should do: # systemctl enable zramswap # systemctl start zramswap

francoism commented on 2014-07-30 15:00 (UTC)

Hello, I'm not exactly know how to use this tool (correctly). dmesg: zram: Created 2 device(s) ... zram0: detected capacity change from 0 to 832368640 zram1: detected capacity change from 0 to 832368640 Adding 812856k swap on /dev/zram0. Priority:100 extents:1 across:812856k SSFS Adding 812856k swap on /dev/zram1. Priority:100 extents:1 across:812856k SSFS Can I now mount /dev/zram0? Do I need to format it first? I'm looking here: https://www.kernel.org/doc/Documentation/blockdev/zram.txt But I don't know if they are the same. Thanks! :)

Nefelim4ag commented on 2014-07-12 19:40 (UTC)

For zram, instead of use several zram devices for multithreading, we can use /sys/block/zram*/max_comp_streams Also, i write external tool https://github.com/Nefelim4ag/zramctl for managment zram devices, i think it can be helpful for this script.

nariox commented on 2014-06-30 17:14 (UTC)

That's a good point (specially for people who need to use older kernels for some reason). If we put a if clause that checks whether COMP is set before setting the compression algorithm. This way we can keep both options. Either way, the "right way" to do this would be by creating a /etc/default/zramswap file where these settings would be set (instead of editing the systemd script directly). What do you think?

rpodgorny commented on 2014-06-24 21:47 (UTC)

hi nariox! thanks for the patch. i'll be happy to include it but i don't think we should override the kernel-set default. would it be possible to make the compression algorithm selection optional (leaving the default up to the kernel)? thanks!

nariox commented on 2014-06-21 23:25 (UTC)

Hey guys, thanks for the good work. Since linux 3.15, we can use lz4 as the compression algorithm for zram. While some benchmarks show that lz4 is not much faster than lzo, I thought it might be worth adding it as default. I've made a patch for zramctrl that makes it easy to switch between the two. You can get it at : http://pastie.org/9312716

melodie commented on 2014-05-26 13:32 (UTC)

Hello, To rpodgorny: thanks a lot! For giving your word and also for taking the maintainer-ship! (You can see my comment from "2014-05-21 22:39" and the ones I answered after). Regards, Mélodie

rpodgorny commented on 2014-05-25 12:19 (UTC)

thank you!

Nefelim4ag commented on 2014-05-25 12:15 (UTC)

Okay, i revert old package from there. http://pkgbuild.com/git/aur-mirror.git/tree/zramswap?id=eb801b8fd234cd615edcd5f4d7ab0b627f163c24 Enjoy it.

rpodgorny commented on 2014-05-25 10:45 (UTC)

whoa! what the hell is this? did you really just overwrite this package with systemd-swap? this is a major NO-NO! 1) the packages may be an obsolete mess but still it's working and deserves to exist. 2) systemd-swap is a completely different implementation with completely different settings system and completely different features. 3) the votes zramswap has accumulated over time were for the original implementation, not the new one. 4) systemd-swap is not ready for prime time, yet. ...so, please keep systemd-swap in systemd-swap and return the original zramswap here. i have no problem taking over the maintanership. thank you!

karol_007 commented on 2014-05-23 09:51 (UTC)

systemd-swap has just been moved to [community] https://projects.archlinux.org/svntogit/community.git/log/trunk?h=packages/systemd-swap

swiftgeek commented on 2014-05-22 03:13 (UTC)

Do You even know about what AUR package You are commenting on? http://pkgbuild.com/git/aur-mirror.git/tree/zramswap/zramctrl?id=eb801b8fd234cd615edcd5f4d7ab0b627f163c24 This happened to sit here for YEARS :< AFAIR it was provided by falconidy as part of bigger package of scripts for systemd in its early days, and few months later dropped to AUR --- Zramswap is custom arch-specific script from eons ago. systemd-swap is mostly a clean rewrite of that with a new name that is more accurate than zramswap. Also new features and better config!

melodie commented on 2014-05-22 02:48 (UTC)

swiftgeek, I have not been impolite to you so please treat me well too. « This package doesn't provide anything beyond that script.» So be it, and please don't feed me with "systemd-swap" telling me it's name is "zramswap". This is not right. → So would you want to have codes and references? Some points to be sure you get it: - replacing a program/feature by a new set of features **with the same name** is not the way to go: imho. - I don't know what is wrong about using awk? The first scripts I was handed over to use compcache did use some awk commands too: https://code.google.com/p/compcache/ The first scripts I used when I have pointed to the zram method many years ago, was a set of lines in a rc.local file. At this time it had been added to a distribution where people had never heard of it yet (around 2010). zRAM was not yet even a kernel module. Why do you want me to read comments? I have gone to read the github page you pointed me to, I have discovered there that keenerd has added a patch not so long ago: last year during summer. Code to read? Let's read code together will you? Here is the code from mystillef: http://mystilleef.blogspot.fr/2011/10/enable-zram-in-fedora.html other former codes: http://bazaar.launchpad.net/~elementary-os/elementaryos/zramswap-enabler/view/head:/debian/zramswap.upstart oh do you notice? No awk here! ;) In Mystillef scripts there is one awk command : in the zramstop script (you can unpack the archive provided to check). In the script I used back a few years ago before the first zram kernel module was delivered, there is a also one awk command, right in the second of these two lines: *************** gprintf "Sizing zram swap device\n" FREE_MEM=`free -t -m | egrep Mem | awk {'print $2'}` *************** I was using a "awk" script?! I didn't even know it! If I understand well the __real issue__ here would be that you have been the packager, and you don't want to maintain it anymore? Maybe someone else will want to continue maintaining it? So please don't hurry and don't throw the baby with the bath.

swiftgeek commented on 2014-05-22 02:15 (UTC)

@melodie WTF⁵⁰⁰ Script for this package used zram devices for swap and nothing else. End of story. This package doesn't provide anything beyond that script. NOBODY brought anything more than idea (remember this was an »awk« script) and now new script with new name provides everything mentioned before and more! And nobody is forcing anyone to use any particular swap technique - and that's a change from old script! FFS please read comments, code (both! old and new), don't FUD etc.

melodie commented on 2014-05-22 01:31 (UTC)

Hi, Other people might want to bring their idea about it before you decide? For myself I know that zram is a kernel module which is originally part of the compcache project. I also know that with _some_ configurations done in the _kernels_ it has sometimes brought freeze trouble in systems, or just hang during boot instead of being loaded, and this, until the specific configuration in the kernel was modified (I'll bring a link from an Ubuntu bug as example here: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1246664 and the fix provided at this point of the discussion: comment #58), I say, just to make a point about this part: the zRAM kernel module is NOT the same as a swap file. Else, the debate running about swapping methods and the different caches existing continues to run among people who work around the kernels and also among the people who perform benchmarks around these features. What is wrong with the original zramswap script?

swiftgeek commented on 2014-05-22 00:12 (UTC)

If anynone would read the comments or checked aur's git would know that: • zramswap is the old unmaintainable awk script that was going to be rewritten to bash since ever and systemd-swap IS that rewrite with changed name, author and maintainer (so it was good for me to be lazy, because this rewrite is much better than the one i would make) • using zram for swap is mostly the same as using file for swap -.- just compressed and lives inside ram • while it's possible to read what old script was doing, improving it isn't feasible - nobody since months and years even tried to do anything mayor with that script and every change made to it was painful and extremely time consuming http://pkgbuild.com/git/aur-mirror.git/tree/zramswap/zramctrl?id=eb801b8fd234cd615edcd5f4d7ab0b627f163c24

Nefelim4ag commented on 2014-05-21 22:51 (UTC)

@melodie You're like Sherlock ;) I have conversation with old maintainer "Swift Geek", and i suggest to remove this package. He explained that can not leave people with orphaned package. And for find solution, we must find compromise. This package it compromise, he leave orphan package, i adopt him. I notified people in comment and post_install. Copy of comment: Comment by Nefelim4ag 2014-05-21 13:12 From now, this is duplicate of https://aur.archlinux.org/packages/systemd-swap/ package, for not leave users with orphan package (zramswap). Anybody, how read this, please install systemd-swap instead zramswap. Because zramswap is dead and be deleted from aur in few months.

melodie commented on 2014-05-21 22:45 (UTC)

PS: this page is not the right one: https://aur.archlinux.org/packages/sy/systemd-swap/ this one is: https://aur.archlinux.org/packages/systemd-swap/

melodie commented on 2014-05-21 22:39 (UTC)

Hi, This package is NOT zramswap: I have just seen my aur package manager submit an update for the zramswap program I have been using for such a long time, and I have been very surprised to read the description in the PKGBUILD: ********** pkgdesc="This is script for creating hybrid swap space from zram swaps, swap files and swap partitions. Swap file - auto create dinamic growing swap file and mount it via loop. For enable: sudo systemctl enable systemd-swap. Config in /etc/systemd-swap.cfg" ********** Whereas the description for the zramswap (version 1.1.1) which is installed into my system is: ********** "Description : Sets up zram-based swap devices on boot" ********** I am not saying that your systemd-swap program is not good, I don't know it, but I DISAGREE STRONGLY about the process that consists in providing it as if it were zramswap ITSELF : this seems to me very close to dishonest. :-( You program being also here: https://aur.archlinux.org/packages/sy/systemd-swap/ and the PKGBUILD: https://aur.archlinux.org/packages/sy/systemd-swap/PKGBUILD shows this different between the *present* zramswap and the one *systemd-swap*: diff = < pkgname=zramswap > pkgname=systemd-swap Here is what the **zramswap** script installed here does and which works a treat as we can see: ****************** $ cat /proc/swaps Filename Type Size Used Priority /dev/sda5 partition 4607996 0 -1 /dev/zram0 partition 506528 0 100 /dev/zram1 partition 506528 0 100 ******************* and here is the content of the script: ******************* $ cat /usr/lib/systemd/scripts/zramctrl #!/bin/sh start() { exec awk -v ZRAM_SIZE=$ZRAM_SIZE ' FILENAME == "/proc/cpuinfo" && ($1 == "processor" || $1 == "Processor") { cpucount++ next } FILENAME == "/proc/meminfo" && $1 == "MemTotal:" { if (ZRAM_SIZE == "") ZRAM_SIZE = 20 mem_total = int( (0 + $2) * 1024 * ( ZRAM_SIZE/100 ) ) next } END { mem_per_cpu = int(mem_total / cpucount) system("modprobe zram num_devices=" cpucount) for (i = 0; i < cpucount; i++) { print mem_per_cpu > "/sys/block/zram" i "/disksize" system("mkswap /dev/zram" i " -L zram" i) swapdevs = swapdevs " /dev/zram" i } system("swapon -p 100" swapdevs) } ' /proc/cpuinfo /proc/meminfo } stop() { exec awk ' FNR > 1 && $1 ~ /^\/dev\/zram[0-9]+$/ { activeswaps = activeswaps " " $1 } END { system("swapoff" activeswaps) system("rmmod zram") } ' /proc/swaps } case $1 in start|stop) "$1" ;; esac *********** and it's start file: *********** $ cat /usr/lib/systemd/scripts/zramctrl #!/bin/sh start() { exec awk -v ZRAM_SIZE=$ZRAM_SIZE ' FILENAME == "/proc/cpuinfo" && ($1 == "processor" || $1 == "Processor") { cpucount++ next } FILENAME == "/proc/meminfo" && $1 == "MemTotal:" { if (ZRAM_SIZE == "") ZRAM_SIZE = 20 mem_total = int( (0 + $2) * 1024 * ( ZRAM_SIZE/100 ) ) next } END { mem_per_cpu = int(mem_total / cpucount) system("modprobe zram num_devices=" cpucount) for (i = 0; i < cpucount; i++) { print mem_per_cpu > "/sys/block/zram" i "/disksize" system("mkswap /dev/zram" i " -L zram" i) swapdevs = swapdevs " /dev/zram" i } system("swapon -p 100" swapdevs) } ' /proc/cpuinfo /proc/meminfo } stop() { exec awk ' FNR > 1 && $1 ~ /^\/dev\/zram[0-9]+$/ { activeswaps = activeswaps " " $1 } END { system("swapoff" activeswaps) system("rmmod zram") } ' /proc/swaps } case $1 in start|stop) "$1" ;; esac ************ I would like it to stay that way, until it is itself in need of an update for any technical reason and I don't see any reason to change now. No freeze, no issue of any kind, on a fully up to date system. Please let systemd-swap be a new one and zramswap keep it's place! Thanks.

gourdcaptain commented on 2014-05-21 21:59 (UTC)

I might also note that systemd-swap's a bit more general purpose script and they may want to disable the other components in the config file. (I'm a guy using the zram swap for a overpowered netbook with 8 GB of RAM and a tiny SSD as a security margin in case I somehow run out of RAM, but I don't want actual swap because I don't want the wear and tear on the SSD.

Nefelim4ag commented on 2014-05-21 20:04 (UTC)

@thiagowfx Thanks, i add post install information.

thiagowfx commented on 2014-05-21 18:57 (UTC)

Hi, I just updated zramswap from 1.x to 2.x. Fortunately I come to this page to see the differences. I'd recommend you to add a post_install message so current users could see they should move to systemd-swap. Thanks!

Nefelim4ag commented on 2014-05-21 13:12 (UTC)

From now, this is duplicate of https://aur.archlinux.org/packages/systemd-swap/ package, for not leave users with orphan package (zramswap). Anybody, how read this, please install systemd-swap instead zramswap. Because zramswap is dead and be deleted from aur in few months.

Nefelim4ag commented on 2014-05-21 11:53 (UTC)

@orschiro Yes, systemd-swap cover zramswap functionally, also he full written on bash. Systemd-swap is combine for managing swap spaces.

orschiro commented on 2014-05-21 05:07 (UTC)

@Nefelim4ag Thanks, systemd-swap has more or less the same functionality as zramswap, correct?

Nefelim4ag commented on 2014-05-20 20:42 (UTC)

Try use https://aur.archlinux.org/packages/systemd-swap/

swiftgeek commented on 2014-04-08 20:47 (UTC)

script is in hiatus and doesn't met expectation of present times, is written in awk (strange choice) besides that i maintain this package to at least maintain functionality of this awk script, which is *very* limited… Also not having any paid job atm doesn't help either in rewriting it :<

orschiro commented on 2014-04-08 20:40 (UTC)

@beta990 It is quite usable. Start the service and see if it has a perceivable effect: # systemctl enable zramswap.service

francoism commented on 2014-04-08 20:02 (UTC)

@swiftgeekL what's the status of this package? Is it usable or something else? I don't get the last comment, so please explain. :P

swiftgeek commented on 2013-12-07 08:43 (UTC)

Ok this script doesn't understand situation when zram is used also for something else… eg. compressed tmpfs … putting rewrite of this script to (im)pure bash in TODO (it doesn't need to be an early service so it doesn't matter so much)

swiftgeek commented on 2013-12-07 08:35 (UTC)

@gyscos sorry i didn't checked script including reboot.

gyscos commented on 2013-12-07 08:04 (UTC)

Zramctrl doesn't properly use ZRAM_PARM in modprobe : Line 22: system("modprobe zram ZRAM_PARM=" cpucount) ZRAM_PARM is inside the double quotes and doesn't seem to be expanded. Instead, system("modprobe zram " ZRAM_PARM "=" cpucount) worked for me.

melodie commented on 2013-12-04 17:48 (UTC)

>Comment by swiftgeek > 2013-08-31 17:55 > on linux 3.10 it is num_devices… If the script once needs 'num_devices' and another time needs 'zram_num_devices', then the script could be changed to something such as: ################ modprobe zram $(modinfo zram | grep -E -o '(num_devices|zram_num_devices)')=$num_cpus ################ as it has been done here (one meant for Debian): http://meets.free.fr/Downloads/Debian/zramconfig/zram/etc/init.d/zram Regards, Mélodie

j00b commented on 2013-08-31 18:09 (UTC)

I'm running 3.0.27 on an ARM machine. I guess I need an update! Thanks anyway.

swiftgeek commented on 2013-08-31 17:55 (UTC)

on linux 3.10 it is num_devices…

j00b commented on 2013-08-31 17:50 (UTC)

I was getting the error: "zram: Unkown parameter 'num_devices'" when starting the service. Turns out that the parameter for the the zram module is 'zram_num_devices' instead of 'num_devices'.

swiftgeek commented on 2013-07-09 09:52 (UTC)

You can set it in service.d file eg. /etc/systemd/system/zramswap.service.d/size.conf [Service] Environment="ZRAM_SIZE=25" 25 is 25% of total RAM

eworm commented on 2013-07-09 09:36 (UTC)

What is the environment variable ZRAM_SIZE good for? At the moment I can not set it at all, no? I removed it from my script and altered the script a bit. Size of zram devices now is about half of physical RAM: https://gist.github.com/5956013

swiftgeek commented on 2013-06-03 11:43 (UTC)

TODO: Introduce means to configure it (eg. for my system it has to be 50% of RAM or less, otherwise real swapping action fails). Probably via ENV (so config would be in /etc/systemd/system/zramswap.d/)

karol_007 commented on 2013-06-02 21:09 (UTC)

@mmm This AUR package doesn't compile anything, the two files it provides are human readable. The code lives in the linux kernel https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/drivers/staging/zram (zram is still in the staging branch) I think the links mentioned in the Wikipedia are nice, but obviously you can search the Wikipedia or the Arch wiki by yourself. If the kernel has zram support: $ zgrep -i zram /proc/config.gz | grep -v "#" CONFIG_ZRAM=m (here, it's not compiled in, but used as a module) you only need this tiny AUR package to make it work.

mmm commented on 2013-06-02 20:31 (UTC)

is there an upstream for this program, or who is developing it? Link to wiki is not so reassuring :)

karol_007 commented on 2013-06-02 01:57 (UTC)

Please update the Maintainer / Contributor part of the PKGBUILD :-)

ifaigios commented on 2013-05-28 13:23 (UTC)

I no longer use this package so I am orphaning it.

lybin commented on 2013-05-28 11:08 (UTC)

https://www.archlinux.org/todo/ Remove old initscipts rc.d files The time since initscipts became unsupported is sufficient that everyone should have transitioned and these files should be removed. Leaving them in packages appears to be causing some confusion among our users.

commented on 2013-05-19 16:57 (UTC)

It does not work in the Raspberry Pi because in the script zramctrl awk counts the lines containing the word 'processor' in /proc/cpuinfo but the for the Pi this file has a different format than in the x86 systems. The easiest solution is to do an ignore case comparison something like: FILENAME == "/proc/cpuinfo" && ($1 == "processor" || $1 == "Processor") { But I don't know what would happen if at some point we have multicore ARMs. For a more robust solution I'd would inspect /sys/devices/system/cpu/cpu[0-9]* Probably the safest is to rely on the current method and only if it fails use the new approach. See in pastebin http://pastebin.com/2ydYbwU5

jskier commented on 2013-01-13 17:59 (UTC)

It does proclaim to have the same amount of swap space as there is RAM on my desktop (I never see the swap utilized), however it is not reserving physical memory unless paging is occurring. Since the swap is compressed, this should not equal all of the physical memory- however it will allocate physical memory of what (if any) is available when the swap is called. So if you only have .5 ~ 2 gigs of RAM being used up anyway, you basically run out of available memory and paging which will either crash or throw an application error from a lack of available memory and page space.

commented on 2013-01-13 16:35 (UTC)

felixonmars: I wan't talking about that, I was talking about hitting the limit on the zram devices. Since they are in memory anyway, they are not true swap devices; suppose you swapped 2 GB of pages to a 2 GB swap device that is on 2 GB of physical memory. If the pages swapeed to zram are not easily compressible, it would mean that most of your physical memory is tied up in swap. I imagine this would trigger some pretty nasty out of memory situations. I'm not an expert on these matters either, but it seems dangerous to me to make that situation possible unless there's reason to believe that the scenario I described should never happen.

felixonmars commented on 2013-01-12 13:24 (UTC)

@loonyphoenix Last time I got a problem in compcache(zram) was because of bigger compressed data (than original data) so the zram got crazy when running out of memory. Within my understanding, they already fixed it by adding an "if" to ignore compressing when compressed data got even bigger than the trunk it could fit in. Yes this would still keep some memory chunk got bigger than they were, but prevent any fault that related to this from happening. Please do correct me if I got the upstream idea wrong, as I am not at all familiar with this, either: )

commented on 2013-01-12 13:14 (UTC)

Hey, I've got a question. Isn't it dangerous to set the size of the swap to be equal to the physical memory size? What if you fill it with poorly compressible data (I see no reason why memory data should always be compressible) - then you've got practically no memory at all.

jskier commented on 2012-12-10 13:11 (UTC)

It seems pretty unstable. Tried this on my bootable thumb drive and it crashes a lot (no good for a btrfs compress USB stick). Desktop works fine but isn't really needed for that, I never need swap with the RAM I have nor do any applications I run use it. comcache isn't being maintained in AUR, other than code itself, functionality-wise I don't think there is much of a difference.

mmm commented on 2012-11-14 15:58 (UTC)

please add systemd support

mmm commented on 2012-11-14 15:53 (UTC)

as reported before, I even started to get kernel freezes now, so I had to stop using zramswap for a while. Is the problem still pervail? Btw, what is difference between zramswap vs comcache? Thanks,

melodie commented on 2012-11-13 19:20 (UTC)

Hello, Thanks for this script. I have two wishes. I would like you guys to point to the real upstream link, which is at the place of the dev of this kernel module: http://code.google.com/p/compcache The other wish I have would be for a configuration file to go along with this PKGBUILD : indeed, I would like to have a simple (kiss) way to choose how many block devices I want and what %age of my available ram I want it to be. I have been used to have the values recommended by the dev of the program : 1 block device and 25% of the available RAM, which fits my ordinary hardware (I have some starting from 512 MB ram to 4 GB ram, and several with 1 GB ram). The first time I have installed zramswap on this one machine which has a brand new install of Arch where systemd is at work, after I installed zramswap my machine hang with a kernel panic, which is the first time it happened since I started using zram, several years ago (when the package name was compcache). I have no idea how that must be set up to be able to work either with initscripts or with systemd, but I hope having a configuration file in both cases could be possible. Cheers, Mélodie

Siot commented on 2012-10-21 09:11 (UTC)

https://bbs.archlinux.org/viewtopic.php?pid=1178757#p1178757 And an answer https://bbs.archlinux.org/viewtopic.php?pid=1178820#p1178820

commented on 2012-10-21 07:50 (UTC)

as far I know systemd-arch-units now only have zramswap service as the only archive in it

leo_rockway commented on 2012-10-14 22:20 (UTC)

This seems related: https://code.google.com/p/compcache/issues/detail?id=102

leo_rockway commented on 2012-10-14 22:04 (UTC)

I get the same errors mmm mentioned. I'm also on Linux from testing (3.6.2 right now, but I noticed this was happening on previous 3.6.x).

mmm commented on 2012-10-07 07:14 (UTC)

Hi, with the latest kernel from testing (3.6), I keep getting a lot of these errors: [ 3273.022920] zram: Error allocating memory for compressed page: 247029, size=4113 [ 3273.022935] Write-error on swap-device (253:0:1976232) Any idea? Thanks in advance, Mark

ifaigios commented on 2012-10-01 19:31 (UTC)

Yes, it is needed if somebody wants an automated script to set up zram devices on boot.

Svenstaro commented on 2012-10-01 05:04 (UTC)

Do you even need this package anymore with systemd?

dront78 commented on 2012-09-28 14:55 (UTC)

It's good package to include mainstream

ifaigios commented on 2012-09-24 18:01 (UTC)

You can now remove systemd-arch-units, as systemd-arch-units-20120915-2 contains only the two files provided by this package.

swiftgeek commented on 2012-09-22 18:25 (UTC)

/usr/lib/systemd/scripts/zramctrl is owned by systemd-arch-units 20120704-5 You could change its name at least or put systemd-arch-units in dependencies

ifaigios commented on 2012-09-22 13:54 (UTC)

I am taking over maintainership of this package. Changes: - Added systemd service file from package systemd-arch-units - Now both the service file and the rc.d script use the same awk script to initialize zram devices - Fixed issue with wrong parameter being used in modprobe (num_devices is the correct parameter as of linux-3.5.4) - Bumped version to 1

linuxJay commented on 2012-09-20 18:14 (UTC)

zram: `8' invalid for parameter `zram_num_devices'

Deciare commented on 2012-09-20 11:58 (UTC)

Sorry, there's too much real-world stuff I have to worry about right now. Someone else can take this package.

dront78 commented on 2012-09-20 05:10 (UTC)

I think systemd is better choice

ifaigios commented on 2012-09-18 18:37 (UTC)

Please provide the respective systemd service file too (now it is provided by the package systemd-arch-units, which is being dismantled)

dront78 commented on 2012-08-31 09:59 (UTC)

you can use modinfo zram | grep -E -o '(num_devices|zram_num_devices)' to detect parameter supported by a kernel and use /dev/null instead of /tmp/zramswap-$$.log

Deciare commented on 2012-06-21 12:28 (UTC)

I can't reproduce the problems people have been having with zram_num_devices, so I'm not sure what to recommend there. This command will tell you how much RAM is currently being compressed on which device: cat /proc/swaps I think there used to be more detailed stats somewhere, but I don't remember where that was now.

SalchiPapa commented on 2012-06-21 05:02 (UTC)

I just installed it today and I'm also getting the zram_num_devices message, arch fully updted, what should I do? Also how do I get to know how much ram is getting compresed, thanks a lot in advance!

Deciare commented on 2012-06-15 17:20 (UTC)

Yes, and the script accounts for both zram_num_devices and num_devices. (It was named num_devices in 3.2 as well.)

dront78 commented on 2012-06-15 17:19 (UTC)

downloaded today they just rename to num_devices with 3.4.2

Deciare commented on 2012-06-15 14:11 (UTC)

If you're using the version of the script from 2012-05-19 or later, it should already be working.

dront78 commented on 2012-06-15 11:38 (UTC)

[ 17.395311] zram: Unknown parameter `zram_num_devices' with latest from stable 3.4.2

linuxJay commented on 2012-06-13 23:07 (UTC)

great. thanks

Deciare commented on 2012-06-13 22:31 (UTC)

That's working as intended. zram may compress up to all available memory as needed, so all 16 GB may be compressed if you have a dire memory shortage. Any memory that is not currently compressed (i.e. outside of swap) remains available as regular uncompressed RAM with no performance penalty.

linuxJay commented on 2012-06-13 22:07 (UTC)

the daemon uses all 16GB of my ram as zramswap. any ideas why? do you need any info?

skydrome commented on 2012-06-04 23:05 (UTC)

use zramswap https://aur.archlinux.org/packages.php?ID=52958

swiftgeek commented on 2012-05-28 12:04 (UTC)

Any chance for systemd service?

Rulatir commented on 2012-05-20 17:57 (UTC)

Add dependency on bc (zram_stats script uses it).

Deciare commented on 2012-05-19 17:51 (UTC)

Good call, thank you. Package updated.

deimos commented on 2012-05-19 17:31 (UTC)

The script mistakenly finds multiple processors on my single processor laptop, because "grep processor /proc/cpuinfo" returns: processor : 0 model name : Intel(R) Pentium(R) M processor 1.60GHz I changed "grep -c processor /proc/cpuinfo" to "grep -c ^processor /proc/cpuinfo" in /etc/rc.d/zramswap, so it is only matching for "processor" at the beginning of a line.

Deciare commented on 2012-05-03 18:35 (UTC)

This package works with LTS. You can confirm that by running: cat /proc/swaps Error messages you may see at start-up are a result of a change in module parameters in kernel 3.2, and can be safely ignored.

kiodo1981 commented on 2012-05-03 18:23 (UTC)

I use LTS kernel but zram doesn't work.

Deciare commented on 2012-05-03 16:49 (UTC)

I upgraded to linux-3.3.4-2 this morning, and zram is working for me. I don't use zcache, but modinfo is showing that as available too.

commented on 2012-05-03 10:37 (UTC)

looks like zram (and zcache) aren't in the stock arch kernel anymore… does anybody know why?

xyproto commented on 2012-02-21 16:44 (UTC)

This package worked for me when compcache didn't, so I like this package better.

Deciare commented on 2012-02-16 18:08 (UTC)

Oh! I sort of didn't know a compcache package also existed. zram is the successor to compcache (a.k.a. ramzswap), so zram does obsolete compcache. However, the compcache AUR package has been updated to use zram. It seems that the compcache package can be configured to work the same way as this one, but the default behaviour is different. Specifically: - This package creates a number of zram devices equal to the number of CPUs on the system. - The compcache package creates up to 4 zram devices, defaulting to 1. - This package creates a number of zram devices whose total size is equal to the amount of installed RAM on the system. - The compcache package defaults to using 25% of installed RAM per zram device. The compcache package's behaviour is configurable; this one is not. That's likely because we followed different directions in creating these packages. I suppose I could make this one configurable, if that would help...?

xyproto commented on 2012-02-16 15:57 (UTC)

Great package. :) Does it obsolete compcache? (https://aur.archlinux.org/packages.php?ID=40063)

Deciare commented on 2012-02-14 17:36 (UTC)

The error message you are seeing is from trying to set the zram_num_devices parameter (for kernel 3.2) before trying the older num_devices parameter. If you check swap space with: cat /proc/swaps You will see that zram devices are still present and enabled.

dront78 commented on 2012-02-14 07:33 (UTC)

there is error while loading kernel lts

ZauberParacelsus commented on 2012-02-13 22:39 (UTC)

nvm, I fixed the problem by rebooting.

ZauberParacelsus commented on 2012-02-13 22:19 (UTC)

I think this package may need to be updated for the kernel again, or something. libkmod: index_mm_open: No such file or directory libkmod: kmod_search_moddep: could not open moddep file '/lib/modules/3.2.4-1-ck/modules.dep.bin' libkmod: index_mm_open: No such file or directory libkmod: kmod_search_moddep: could not open moddep file '/lib/modules/3.2.4-1-ck/modules.dep.bin' /etc/rc.d/zramswap: line 26: /sys/block/zram0/disksize: No such file or directory /etc/rc.d/zramswap: line 26: /sys/block/zram1/disksize: No such file or directory /etc/rc.d/zramswap: line 26: /sys/block/zram2/disksize: No such file or directory /etc/rc.d/zramswap: line 26: /sys/block/zram3/disksize: No such file or directory /dev/zram0: No such file or directory /dev/zram1: No such file or directory /dev/zram2: No such file or directory /dev/zram3: No such file or directory swapon: /dev/zram0: stat failed: No such file or directory swapon: /dev/zram1: stat failed: No such file or directory swapon: /dev/zram2: stat failed: No such file or directory swapon: /dev/zram3: stat failed: No such file or directory [DONE]

cbowman57 commented on 2012-01-21 13:52 (UTC)

Thanks for adopting it Deciare.

Deciare commented on 2012-01-19 18:02 (UTC)

Adopted and updated to support kernel 3.2.

Svenstaro commented on 2012-01-15 15:58 (UTC)

Feel free to take the package and fix it. I don't use it anymore. It still works for normal usage.

cbowman57 commented on 2012-01-12 18:59 (UTC)

If you bounce back & forth between the 3.1 & 3.2 kernels you might like to modify your /etc/rc.d/zramswap file. modprobe zram zram_num_devices=$num_cpus [[ "zram_num_devices" < 1 ]] || modprobe zram num_devices=$num_cpus << new entry It's probably not perfectly correct but it works.

commented on 2012-01-10 11:30 (UTC)

"On July 20th 2011, the zram driver in the linux 3.1 staging area was modified to use zram_num_devices as modprobe parameter - so if you use a recent kernel, update your init scripts!" http://code.google.com/p/compcache/wiki/Scalability#Details

kiodo1981 commented on 2012-01-07 12:51 (UTC)

Problem with kernel 3.2 CK

mmm commented on 2012-01-06 11:14 (UTC)

x0b1t's advice fixes it, confirm. but i still get complaint: sudo /etc/rc.d/compcache start :: Starting Compcache [BUSY] FATAL: Module lzo_compress not found. FATAL: Module lzo_decompress not found. [DONE] ..using standart arch kernel, compcache seems to work anyway though

commented on 2012-01-05 20:46 (UTC)

after update to linux 3.2 (from testing) - need make some changes. params for zram-module were changed. num_devices -> zram_num_devices edit /etc/rc.d/compcache. command for module initilization looks like now as : modprobe zram zram_num_devices=$DEVICES_COUNT >> $LOG_FILE 2>&1

commented on 2011-12-13 19:16 (UTC)

Yep, a reboot and a yaourt -S compcache made all.

mortzu commented on 2011-12-13 16:04 (UTC)

So it works?

commented on 2011-12-13 15:51 (UTC)

Oops, i updated the kernel earlier and i haven't rebooted yet, i should use yaourt -Sf next boot.

commented on 2011-12-13 15:50 (UTC)

After the update from version 234-1 to 20111213-1 i've got this error: You need to have compcache listed in deamons in /etc/rc.conf to have it started at boot, like: DAEMONS=(aaaa bbbb compcache) To start it in background put there @compcache... You can (should) modify the size of virtual swap disk in configuration file: /etc/conf.d/compcache. New version of config file is saved as compcache.pacnew Also note, it is HIGHLY RECOMMENDED to have your kernel patched to provide all functionality, see homepage or readme file to learn more.... Or you can check out ZEN kernel (should allready be patched) from aur. Initscript outputs are redirected to /var/log/compcache.log WARNING: Couldn't open directory /lib/modules/3.1.4-1-ARCH: No such file or directory FATAL: Could not open /lib/modules/3.1.4-1-ARCH/modules.dep.temp for writing: No such file or directory errore: l'esecuzione del comando non è riuscita correttamente ...but i think that is installed.

Svenstaro commented on 2011-12-07 16:45 (UTC)

Can't reproduce with core kernel.

Nierro commented on 2011-12-07 16:44 (UTC)

me too with kernel 3.1.4 on netbook, and with netbook-kernel too...

skydrome commented on 2011-12-04 19:35 (UTC)

anyone have this problem on the linux-mainline kernel? :: Enabling zram-based swap [BUSY] FATAL: Error inserting zram (/lib/modules/3.2.0-1-mainline/kernel/drivers/staging/zram/zram.ko.gz): Unknown symbol in module, or unknown parameter (see dmesg) /etc/rc.d/zramswap: line 26: /sys/block/zram0/disksize: No such file or directory /etc/rc.d/zramswap: line 26: /sys/block/zram1/disksize: No such file or directory /dev/zram0: No such file or directory /dev/zram1: No such file or directory swapon: /dev/zram0: stat failed: No such file or directory swapon: /dev/zram1: stat failed: No such file or directory

commented on 2011-11-17 14:10 (UTC)

The current PKGBUILD does not work with the latest pacman v4. To fix can you please change: install=(${pkgname}.install) to install=${pkgname}.install Thanks

blackout24 commented on 2011-11-14 22:04 (UTC)

Thank you for contributing to the AUR!

kiodo1981 commented on 2011-11-03 21:08 (UTC)

I have not enabled the SWAP, can I exploit the potential of this program without it?

commented on 2011-10-10 01:15 (UTC)

I agree, thanks for this!

Svenstaro commented on 2011-10-09 13:21 (UTC)

Of course.

shadowed87 commented on 2011-10-09 10:03 (UTC)

thank you for this package!!

Huulivoide commented on 2011-07-24 10:45 (UTC)

Please disable the building of the kernel module as zram is alredy in the kernel tree, and build by default in arch.

anish commented on 2011-06-22 22:11 (UTC)

on the other hand, /etc/conf.d/compcache ends up with 755, when it should be a 644

anish commented on 2011-06-22 22:06 (UTC)

The line "install -Dm 744 $startdir/compcache.init $pkgdir/etc/rc.d/compcache" is wrong. All files in /etc/rc.d have 755 persmissions, not 744

commented on 2011-04-17 23:50 (UTC)

Turns out my previous comment contained error. The matching part should be: grep -o '/dev/zram[0-9]*' /proc/swaps So the whole line reads: for DVC in `grep -o '/dev/zram[0-9]*' /proc/swaps`; do Additionally the fix for SIZE will be something like this: $(echo $(($SIZE*1024/$DEVICES_COUNT)) > /sys/block/zram$(($i-1))/disksize) >> $LOG_FILE 2>&1

commented on 2011-04-17 23:43 (UTC)

I found two problems with this package. Both concerns compcache.init file. 1) Stopping compcache causes all swap devices to stop. Instead we should only disable zram devices. So it should be something like this (tested & working): stop) stat_busy "Stopping $DESC " for DVC in `grep -o /dev/zram* /proc/swaps`; do echo "swapoff $DVC" >> $LOG_FILE swapoff $DVC >> $LOG_FILE 2>&1 echo 1 > /sys/block/`basename $DVC`/reset done 2) SIZE doesn't take DEVICES_COUNT into account. Therefore with default size of 25% with devices count = 4 it suddendly take whole ram... which isn't good. I think the best course of action here is to divide SIZE by DEVICE_COUNT.

commented on 2011-03-06 14:00 (UTC)

it would be good to include sub-projects/scripts/zram_stats to /usr/bin in the package it is a helper script which shows statistics, as mentioned in the README

mortzu commented on 2011-02-13 16:20 (UTC)

fixed. sorry for that

hydro commented on 2011-02-13 13:28 (UTC)

Please take a look at compcache.init, default size of RAM is not computed correctly (25% = 1/4).

mortzu commented on 2011-01-23 21:14 (UTC)

it runs with 2.6.37

cotton commented on 2011-01-19 13:22 (UTC)

Anyone got compcache working with kernel26-2.6.37ck (or even kernel26-2.6.37)? Or has it been incorporated into the kernel yet?

Rulatir commented on 2010-12-20 07:47 (UTC)

The only stable compcache I have ever had was the original 0.6.2 on the last kernel that supported it, right before the mainline adoption fiasco started. Since then EVERY compcache/ramzswap/zram build I've ever tried with ANY kernel suffers from the same symptom: running programs start crashing out of the blue when large amounts of data are swapped back in from the compressed swap. Completely unusable.

mortzu commented on 2010-12-01 12:03 (UTC)

updated. thx

commented on 2010-11-30 18:48 (UTC)

Here is the Error Message that i receive when i try to install it. I have removed and then reinstall and still have this message http://pastebin.com/b9GSZyjV

mortzu commented on 2010-10-09 07:45 (UTC)

changed.

commented on 2010-10-08 22:30 (UTC)

The script "/etc/rc.d/compcache can not set the size of /dev/zram I managed to fix it by changing this line (line 51) [[ -n $SIZE ]] && echo $(($SIZE*1024)) > /sys/block/zram$(($i-1))/disksize >> $LOG_FILE 2>&1 by [[ -n $SIZE ]] && $(echo $(($SIZE*1024)) > /sys/block/zram$(($i-1))/disksize) >> $LOG_FILE 2>&1

gaougalos commented on 2010-09-18 23:21 (UTC)

==> Starting build()... /home/christos/mountPoint/packaging/compcache/PKGBUILD: line 22: cd: /home/christos/mountPoint/packaging/compcache/src/compcache: No such file or directory Aborting...

commented on 2010-09-09 03:06 (UTC)

Maybe add mercurial to makedepends?

mortzu commented on 2010-08-23 22:01 (UTC)

i want to provide a script to rebuild the module like virtualbox do

korin43 commented on 2010-08-23 19:13 (UTC)

This is way more complicated as an AUR package since it can only be built on the currently running kernel, so a kernel update now consists of: 1. Remove compcache 2. Update kernel 3. Reboot 4. Build and install compcache

Chadi commented on 2010-08-21 15:34 (UTC)

Thanks for the package ! Maybe add kernel26-headers and mercurial as build dependencies?