home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / kb / Admin / zram < prev   
Internet Message Format  |  2013-04-23  |  2KB

  1. Date: Wed, 24 Apr 2013 12:55:27 +1000
  2. From luv-main-bounces@luv.asn.au Tue Apr 23 19: 5:53 2013
  3. From: Russell Coker <russell@coker.com.au>
  4. To: luv-main@luv.asn.au
  5. Subject: zram
  6. Reply-To: russell@coker.com.au
  7.  
  8. There has been some discussion on luv-talk (which should have been on luv-
  9. main) about zram, a system that uses a compressed RAM disk for swap on Linux.
  10.  
  11. I've enabled zram on one of my systems.  I ran "free" on all the systems I run
  12. and found that only one had any significant swap use, that's a workstation with
  13. 8G of RAM and 512M of swap in use.  I didn't bother enabling it on any other
  14. systems.
  15.  
  16. I added "zram" to /etc/modules (modules that are loaded on boot on Debian).  I
  17. created /etc/modprobe.d/zram.conf with the following contents:
  18. options zram num_devices=2
  19.  
  20. This gives two devices and it seems that you are expected to have one zram
  21. device for each CPU core.  I'm not sure if this is really required but it
  22. doesn't seem to do any harm.
  23.  
  24. To enable zram on boot I added the following to /etc/rc.local:
  25.  
  26. echo 1073741824 > /sys/block/zram0/disksize
  27. echo 1073741824 > /sys/block/zram1/disksize
  28. mkswap /dev/zram0
  29. mkswap /dev/zram1
  30. swapon -p 100 /dev/zram0
  31. swapon -p 100 /dev/zram1
  32.  
  33. The above sets each of the two devices to 1G of storage and enables them as
  34. swap space.
  35.  
  36. I haven't yet rebooted the system to make sure that there are no errors in the
  37. above, but as it's what I types on the command-line it should work.  Also I
  38. haven't tested zram extensively.
  39.  
  40. Finally I'm running the Debian/Experimental 3.8 kernel.  I don't know how it
  41. would work on other kernels.
  42.  
  43. --
  44. My Main Blog         http://etbe.coker.com.au/
  45. My Documents Blog    http://doc.coker.com.au/
  46. _______________________________________________
  47. luv-main mailing list
  48. luv-main@luv.asn.au
  49. http://lists.luv.asn.au/listinfo/luv-main
  50. :
  51.