Skip to main content

zRAM for your IoT Single Board Computer running Linux

Linux zRAM configuration
zRam is a code inside kernel, that once activated, creates a RAM based block device which acts as a swap disk, but is compressed and stored in memory, allowing very fast I/O and increasing the amount of memory available before the system starts swapping to disk.
zRam is integrated into the Linux kernel 3.2 and above, so it's included already in Ubuntu 12.04.
Previously on my 2GB machine, without zRAM, when i open lots of browser tabs, the system start choking, while HDD start copying data to SWAP causing a total slowdown. Now after activating zRam, instead of freezing after running out of RAM, the system worked like nothing happened. I didn't notice any difference at all. It looked just like adding more RAM ;)
From my experience, zRam is useful for people using computers with 1GB or 2GB RAM. Since zRam is compressing data, it require some processor resources. Not much, but always. For that reason i do not recommend to use it with old processors. Also if you have 4GB RAM most likely it won't be necessary to use it.
To activate it, type in terminal:
sudo apt-get install zram-config
To remove [type the following]:
sudo dpkg --purge zramswap-enabler
sudo dpkg --purge zram-config

To verify the service daemon [type the following]:
cat /proc/swaps

there should be some /dev/XXX entry on the zRAM service.


Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       336928  172     5
If you have issues installing zRAM on ubuntu, 

invoke-rc.d: initscript zram-config, action "start" failed.
dpkg: error processing package zram-config (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
 zram-config
E: Sub-process /usr/bin/dpkg returned an error code (1)
type the following before re-installing zRAM:
sudo apt-get install linux-image-extra-$(uname -r)
sudo apt-get install zram-config

Comments

Popular posts from this blog

hreflang? what is it? where does it come from?

Hreflang tags are a technical solution for sites that have similar content in multiple languages. The owner of a multilingual site wants search engines to send people to the content in their own language. Say a user is Dutch and the page that ranks is English, but there’s also a Dutch version. You would want Google to show the Dutch page in the search results for that Dutch user. This is the kind of problem hreflang was designed to solve. And for the  Webmasters who serve several versions of their content in different languages or for users in different countries should use   hreflang annotations   to help Google show the right version in the search results for each user. In this article, " How to implement hreflang tags... ", the author has lay out the steps from begin to finish on the right ways of implementing hreflang tags for your multilingual and multinational web sites. In another article, " hreflang: the ultimate guide ", the author has outlined the

Creating a file-based SWAP on your Beagleboard

On the Beagleboard you should expect to require a swap file given the limitation of how little RAM is available (between 256 MB and 512 MB). Some system programs like apt-get will only run properly when some swap space is present (due to 256 MB not being enough RAM). Some images (such as those from Linaro.org) do not come with a swap partition or any swap space allocated. Under Linux, swap space can be either a dedicated partition or a swap file. Both can be mounted as swap which the OS can access. Creating a Swapfile The following commands will create a 512MB file, limit access only to root, format it as swap and then make it available to the OS: sudo mkdir -p /var/cache/swap/ sudo dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=512 sudo chmod 0600 /var/cache/swap/swapfile sudo mkswap /var/cache/swap/swapfile sudo swapon /var/cache/swap/swapfile To tell the OS to load this swapfile on each start up, edit the /etc/fstab file to include the following addi

Tcpdump Tutorial With Examples

Tcpdump is a common packet analyzer that runs under the command line. It allows the user to display TCP/IP and other packets being transmitted or received over a network to which the computer is attached.[3] Distributed under the BSD license,[4] tcpdump is free software. Tcpdump works on most Unix-like operating systems: Linux, Solaris, FreeBSD, DragonFly BSD, NetBSD, OpenBSD, OpenWrt, macOS, HP-UX 11i, and AIX. In those systems, tcpdump uses the libpcap library to capture packets. The port of tcpdump for Windows is called WinDump; it uses WinPcap, the Windows port of libpcap. I've read through a lot of how-to articles in the past. and this article "TCPDUMP Tutorial with Examples" is the most thorough, most intuitive articles that I've read.