Package Details: zramswap 1.1-1

Git Clone URL: https://aur.archlinux.org/zramswap.git (read-only)
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: 202
Popularity: 1.689219
First Submitted: 2011-10-05 23:35
Last Updated: 2015-06-14 19:57

Dependencies (1)

Required by (0)

Sources (2)

  • zramctrl
  • zramswap.service

Latest Comments

Anakon commented on 2015-10-08 11:27

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

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

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

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

# 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"
}

bluerider commented on 2015-04-05 20:33

I made my own version using zramctl. I think it's significantly more robust this script. You want to use mine instead? It's MIT licensed.

The needed files are at : <https://github.com/bluerider/zramswap/tree/master>

In addition, I have a working PKGBUILD :

# 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=('GPL')
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

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

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

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

Nefelim4ag commented on 2014-08-19 21:17

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

All comments