[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Configuring a system for zram



Short version, I got the thing I was working on in the meeting to
actually work correctly.  The end result is here:

  https://github.com/silug/puppet-zram

Longer version, to enable zram without using Puppet, drop this script in
/lib/udev/zram (and make sure it is executable):

  https://raw.githubusercontent.com/silug/puppet-zram/master/files/zram.sh

Drop a file like this in /etc/udev/rules.d/01-zram.rules:

  KERNEL=="zram*", ACTION=="add", RUN=="/lib/udev/zram 105388441"

The number at the end will be the size of the swap devices in bytes.

Create /etc/modprobe.d/zram.conf with the following contents:

  options zram num_devices=4

The number of devices needs to match the number of CPU cores in the
system.

Finally, run "modprobe zram".  Eventually, you should see something like
this in /proc/swaps:

  Filename                                Type            Size    Used    Priority
  /dev/zram1                              partition       102916  0       32767
  /dev/zram3                              partition       102916  0       32767
  /dev/zram2                              partition       102916  0       32767
  /dev/zram0                              partition       102916  0       32767

Note that there is a dependency on systemd in the zram.sh script, so you
need to be on a reasonably modern distribution if you want everything to
Just Work.

Steve
-- 
steve@silug.org           | Southern Illinois Linux Users Group
(618)624-4440             | See web site for meeting details.
Steven Pritchard          | http://www.silug.org/

-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.