Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cat /etc/udev/rules.d/10-zram.rules
- ACTION=="add", SUBSYSTEM=="block", KERNEL=="zram0", DRIVER=="", ATTR{disksize}=="0", ATTR{disksize}="512M", RUN+="/usr/bin/systemd-run /sbin/mkswap $env{DEVNAME}"
- # cat /etc/modules-load.d/zram.conf
- zram
- # cat /etc/modprobe.d/zram.conf
- options zram num_devices=1
- # journalctl -o short | grep zram
- Aug 04 21:28:54 system kernel: zram: module is from the staging directory, the quality is unknown, you have been warned.
- Aug 04 21:28:54 system kernel: zram: Created 1 device(s) ...
- Aug 04 21:28:54 system systemd-modules-load[459]: Inserted module 'zram'
- Aug 04 21:28:55 system kernel: zram: Initialization done!
- Aug 04 21:28:55 system systemd[1]: Found device /dev/zram0.
- Aug 04 21:28:55 system systemd[1]: Activating swap /dev/zram0...
- Aug 04 21:28:55 system swapon[494]: swapon: /dev/zram0: read swap header failed: Invalid argument
- Aug 04 21:28:55 system systemd[1]: dev-zram0.swap swap process exited, code=exited status=255
- Aug 04 21:28:55 system systemd[1]: Failed to activate swap /dev/zram0.
- Aug 04 21:28:55 system systemd[1]: Unit dev-zram0.swap entered failed state.
- Aug 04 21:28:55 system systemd[1]: Started /sbin/mkswap /dev/zram0.
- Aug 04 21:28:55 system systemd[1]: Starting /sbin/mkswap /dev/zram0...
- Aug 04 21:29:15 system dracut[3292]: -rw-r--r-- 1 root root 27 Aug 4 21:28 etc/modprobe.d/zram.conf
- Aug 04 21:29:15 system dracut[3292]: -rw-r--r-- 1 root root 5 Aug 4 15:09 etc/modules-load.d/zram.conf
- Aug 04 21:29:16 system dracut[3292]: drwxr-xr-x 2 root root 0 Aug 4 21:29 usr/lib/modules/3.10.0-327.10.1.el7.x86_64/kernel/drivers/staging/zram
- Aug 04 21:29:16 system dracut[3292]: -rw-r--r-- 1 root root 28701 Feb 16 17:45 usr/lib/modules/3.10.0-327.10.1.el7.x86_64/kernel/drivers/staging/zram/zram.ko
- echo 512M > /sys/block/zram0/mem_limit
- mkswap /dev/zram0
- swapon /dev/zram0
- Summary: Enable compressed swap in memory
- Name: zram
- Version: 1.0.0
- Release: 2%{?dist}
- License: GPLv2
- Group: System Environment/Daemons
- Source0: %{name}-%{version}.tar.bz2
- BuildArch: noarch
- BuildRequires: systemd-units
- Requires(post): systemd-sysv
- Requires(post): systemd-units
- Requires(preun): systemd-units
- Requires(postun): systemd-units
- Requires: filesystem >= 2.0.1, initscripts, bc > 1.0
- # No debug info for bare scripts, right?
- %define debug_package %{nil}
- # http://fedoraproject.org/wiki/Changes/UnversionedDocdirs
- %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
- %global _docdir_fmt %{name}
- %description
- zram compresses swap partitions into RAM for performance.
- You need Linux kernel version 2.6.37.1 or better to use zram.
- %prep
- %setup -q
- %build
- %install
- mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
- mkdir -p $RPM_BUILD_ROOT%{_unitdir}
- ln -s $RPM_BUILD_ROOT/usr/lib $RPM_BUILD_ROOT/lib
- mkdir -p $RPM_BUILD_ROOT%{_sbindir}
- %makeinstall DESTDIR=$RPM_BUILD_ROOT
- %post
- %systemd_post mkzram.service
- %preun
- %systemd_preun mkzram.service
- %postun
- %systemd_postun_with_restart mkzram.service
- %files
- %doc README.md
- %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
- %{_unitdir}/mkzram.service
- %{_sbindir}/zramstart
- %{_sbindir}/zramstop
- %{_sbindir}/zramstat
- %exclude /lib
- %changelog
- * Tue Nov 25 2014 Juan Orti <jorti@fedoraproject.org> - 1.0.0-1
- - Spec file cleanup
- * Mon Nov 25 2013 Doncho Gunchev <dgunchev@gmail.com> - 0:1.0.0-2
- - http://fedoraproject.org/wiki/Changes/UnversionedDocdirs
- - Added kmod-staging dependency
- - Test on Fedora 19
- * Mon Sep 02 2013 Doncho Gunchev <dgunchev@gmail.com> - 0:1.0.0-1
- - Add Darren Steven's build fix for fedora 18
- * Tue Mar 19 2013 Doncho Gunchev <dgunchev@gmail.com> - 0:1.0.0-0
- - Initial package
- KERNEL=="zram*", ACTION=="add", SUBSYSTEM=="block", ATTR{initstate}=="0", ATTR{comp_algorithm}="lz4", ATTR{max_comp_streams}="26", ATTR{disksize}="180G", RUN+="/bin/sh -c '/sbin/mkswap $env{DEVNAME}; /sbin/swapon $env{DEVNAME} -p10'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement