Home » Posts tagged 'Ubuntu'

Tag Archives: Ubuntu

Placing Firefox cache in RAM on Ubuntu

To enhance Firefox performance on Ubuntu (or Linux), we can place the cache in RAM. This is especially helpful if you are used to hours of continuous browsing sessions.

I have mounted some directories with temporary files using the tmpfs, which is RAM based filesystem. These files will be discarded at reboot, which also helps to keep my system clean.

The entries in /etc/fstab are like:

tmpfs /tmp tmpfs noexec,defaults,noatime,nodiratime 0 0
tmpfs /var/log tmpfs noexec,defaults,noatime,nodiratime 0 0
Add the following line at the end of /etc/sysctl.conf file:

vm.swappiness = 0

# sudo sysctl -p
In Firefox, go to about:config page and search for the following entry:

If it is not there, right click and create a new String value and name it as

Set the value to /tmp (or tmpfs directory of your choice). Restart Firefox.

Different between ZRAM and ZSWAP

First answer :

ZRAM is a module of the Linux kernel, previously called “compcache”. ZRAM increases performance by avoiding paging on disk and instead uses a compressed block device in RAM in which paging takes place until it is necessary to use the swap space on the hard disk drive. Since using RAM is faster than using disks, zram allows Linux to make more use of RAM when swapping/paging is required, especially on older computers with less RAM installed.

ZSWAP is a lightweight compressed cache for swap pages. It takes pages that are in the process of being swapped out and attempts to compress them into a dynamically allocated RAM-based memory pool. zswap basically trades CPU cycles for potentially reduced swap I/O. This trade-off can also result in a significant performance improvement if reads from the compressed cache are faster than reads from a swap device.

Second answer :


  • Status: In staging tree (as of 3.7) and looking to move into mainline
  • Implementation: compressed block device, memory is dynamically allocated as data is stored
  • Usage: Configure zram block device as a swap device to eliminate need for physical swap defice or swap file
  • Benefits:
    1. Eliminates need for physical swap device. This beame popular when netbooks first showed up. Zram (then compcache) allowed users to avoid swap shortening the lifespan of SSDs in these memory constrained systems.
    2. A zram block device can be used for other applications other than swap, anything you might use a block device for conceivably.
  • Drawbacks:
    1. Once a page is stored in zram it will remain there until paged in or invalidated. The first pages to be paged out will be the oldest pages (LRU list), these are ‘cold’ pages that are infrequently access. As the system continues to swap it will move on to pages that are warmer (more frequently accessed), these may not be able to be stored because of the swap slots consumed by the cold pages. What zram can not do (compcache had the option to configure a block backing device) is to evict pages out to physical disk. Ideally you want to age data out of the in-kernel compressed swap space out to disk so that you can use kernel memory for caching warm swap pages or free it for more productive use.


  • Status: Posted to LKML on Dec 11th, 2012
  • Implementation: compressed in-kernel cache for swap pages. In-kernel cache is compressed, the compression algorithm is pluggable using the CryptoAPI and the storage for pages is dynamically allocated. Older pages can be evicted to disk making this a sort of write-behind cache.
  • Usage: Cache swap pages destined for regular swap devices (or swap files).
  • Benefits:
    1. Integration with swap code (using Frontswap API) allows zswap to choose to store only pages that compress well and handle memory allocation failures, in those cases pages are sent to the backing swap device.
    2. Oldest pages in the cache are pushed out to backing swap device to make room for newer pages, this solves the LRU inversion problem that a lack of page eviction would present.
  • Drawbacks:
    1. Needs a physical swap device (or swapfile).

Compressing RAM with zRam

A successor to compcache, zram, has been already integrated in the Linux kernel for a while now. This means that no additional compilation nor tweaking is required to benefit from compressing memory on the fly and massively reduced swapping.

As with compache, I wanted to nicely integrate the solution into the Ubuntu Upstart deamon – hence this short article. After a couple of minutes of playing the configuration was ready.

Create file zramswap.conf in /etc/init and put the following content in it.

description "Initializes zram swaping"
start on runlevel [2345]
stop on runlevel [!2345]
pre-start script
# load dependency modules
modprobe zram num_devices=2
# initialize the devices
echo 1073741824 > /sys/block/zram0/disksize
echo 1073741824 > /sys/block/zram1/disksize
# Creating swap filesystems
mkswap /dev/zram0
mkswap /dev/zram1
# Switch the swaps on
swapon -p 5 /dev/zram0
swapon -p 5 /dev/zram1
end script
post-stop script
# Switching off swap
swapoff /dev/zram0
swapoff /dev/zram1
rmmod zram
end script

Now you can start the service with sudo start zramswap (it will be automatically started on after the reboot as well).
You will benefit from 2x1GB swap files, which will be compressed and stored in the RAM. Tested on Ubuntu 13.10.

Add RAM to Ubuntu 13.10+ for free: zRAM

In the mainline generic kernel of Ubuntu, there’s a module called zram. This is a pretty good trick to add additional “free” RAM to your machine without any change: it creates in-memory compressed block for swap, meaning it eats a bit of your CPU but gives you literally more RAM.

If you’re on a VPS for example, having 512 MB RAM, this would actually give you access to 750 MB RAM and would eat just a little CPU from you – I don’t even notice it on the Munin graphs.

To install:

apt-get install zram-config

Make sure it’s started and running:

cat /proc/swaps

If you see something like this

# cat /proc/swaps 
Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       62712   6804    5
/dev/zram1                              partition       62712   6768    5
/dev/zram2                              partition       62712   6744    5
/dev/zram3                              partition       62712   6768    5

then it’s already running.

Reboot your machine, and voilá. You might even turn your regulat disk-swap off.

ZRAM on Debian/Ubuntu for Memory Overcommitment

In recent Linux releases, it’s available a tiny module called zram, that permits us to create RAM based block devices (named /dev/zramX), which will be kept in memory as compressed data. These ram-based block devices allow very fast I/O, and compression provides a reasonable amounts of memory saving.

We can use it as a drop-in replacement for the well-known tmpfs (used for speeding up compilation tasks or for /tmp), or better as a primary swap device, that will lead to virtually increase memory capacity, at the expense of a slightly increased CPU usage to compress/decompress the swapped data.

Nowadays RAM is very cheap, so why bother with compression? Because there are some situations where you can’t upgrade memory (netbooks) or you want to over-commit real resources (virtualization hosts).

For Ubuntu Precise and later:

Starting with Ubuntu Precise, there is an official upstart script for Ubuntu by Adam Conrad to configure zram in the main repository:

Bermain-main dengan btrfs dengan Linux Mint 13

Setelah membaca-baca sedikit tentang btrfs, gw putuskan untuk langsung mencoba btrfs. Secara default, Linux Mint 13 belum support btrfs. Gw harus menambahkan tools, btrfs-tools. Tools ini akan digunakan untuk melakukan konversi file system dari ext3 yang selama ini gw pakai menjadi btrfs.

Secara umum btrfs menawarkan sejumlah kelebihan dibandingkan filesystem linux yang lain. Hanya saja, btrfs belum dinyatakan stabil dan tidak disarankan untuk digunakan untuk production system.


Btrfs is a new copy on write filesystem for Linux aimed at implementing advanced features while focusing on fault tolerance, repair and easy administration. Initially developed by Oracle, Btrfs is licensed under the GPL.

Note that Btrfs does not yet have a fsck tool that can fix errors. While Btrfs is stable on a stable machine, it is currently possible to corrupt a filesystem irrecoverably if your machine crashes or loses power on disks that don’t handle flush requests correctly. This will be fixed when the fsck tool is ready.


Linux has a wealth of filesystems to choose from, but we are facing a number of challenges with scaling to the large storage subsystems that are becoming common in today’s data centers. Filesystems need to scale in their ability to address and manage large storage, and also in their ability to detect, repair and tolerate errors in the data stored on disk.

The main Btrfs features available at the moment include:

  • Extent based file storage
  • 2^64 byte == 16 EiB maximum file size
  • Space-efficient packing of small files
  • Space-efficient indexed directories
  • Dynamic inode allocation
  • Writable snapshots, read-only snapshots
  • Subvolumes (separate internal filesystem roots)
  • Checksums on data and metadata
  • Compression (gzip and LZO)
  • Integrated multiple device support
  • RAID-0, RAID-1 and RAID-10 implementations
  • Efficient incremental backup
  • Background scrub process for finding and fixing errors on files with redundant copies
  • Online filesystem defragmentation

Additional features in development, or planned, include:

  • RAID-5 and RAID-6
  • Object-level mirroring and striping
  • Alternative checksum algorithms
  • Online filesystem check
  • Efficient incremental filesystem mirroring


Setelah instalasi btrfs-tools, gw buka terminal :

1. Unmount file system yang akan di-convert.

$sudo umount /backup

2. Lakukan konversi

$sudo btrfs-convert /dev/sda7

3. Setelah selesai konversi, lakukan check UUID untuk filesystem baru (karena Linux Mint menggunakan informasi blkid suatu partisi untuk melakukan mounting di /etc/fstab). Bisa juga menggunakan info seperti /dev/sdax, like oldis style.

$sudo blkid /dev/sda7

4. Edit file /etc/fstab untuk mengubah informasi filesystem dan blkid yang baru saja didapatkan.

5. Aktifkan juga algoritma kompresi untuk filesystem btrfs. Bisa zlib, bisa juga lzo.

Selamat mencoba !!


Building a Samba 4 Active Directory Domain

In this Article, i will outline the configuration of a small Active Directory using Samba4.

The Ubuntu versions involved is 12.04. I assume that you have modest knowledge on how to configure Ubuntu on the command line – i.e. i will not explain every single step in detail.

Network parameters we will use are:

Network name:demo.local
IP Range:

Base System and Samba 4

Step 1: Install a Ubuntu 12.04 System
Step 2: Configure the Network to use a static address. Edit /etc/network/interfaces:

auto lo eth0
iface lo inet loopback
iface eth0 inet static
dns-search demo.local

Step 3: Add the basic host entries to resolve without DNS

Edit /etc/hosts and insert:

2       localhost  vupapsam401 vupapsam401.demo.local

Step 4: Install the Samba 4 Packages

Nama-nama kode Linux Ubuntu

Distro Ubuntu saat ini menduduki posisi kedua versi distrowatch.com sebagai distro yang paling banyak dipakai di seluruh dunia. Salah satu kelebihan ubuntu adalah diterbitkannya versi baru ubuntu setiap enam bulan sekali dan mendapat dukungan dari canonical selama 18 bulan setelahnya. Canonical juga merilis versi LTS (long term support) setiap dua tahun (sesuai jadwal) dan mendapat dukungan (support) selama tiga tahun setelah dirilis. Ini dia tabel lengkap kode nama ubuntu:
Ubuntu menggunakan  kode bulan dan tahun untuk menamai versi nama distro yang mereka rilis. Untuk memudahkan memahaminya inilah ilustrasinya Versi 4.10 artinya versi tersebut dirilis pada bulan Oktober tahun 2004. Kalau sesuai rencana canonical akan merilis versi terbaru ubuntu pada bulan April 2012, kode nama distronya Precise Pangolin.
Precise Pangolin merupakan LTS distro yang akan mendapat support dari canonical dari bulan April 2010 hingga April 2017.
The first “hog”
Mammalia (mammals)
Suidae (pigs)
Meaning “covered with hair”, or “mature/old/wise”
Mammalia (mammals)
was going to be “Bendy Badger”… Smile :)
Mammalia (mammals)
Mustelids (weasels)
Polished, with 5 years of support!
Aves (birds)
Anatidae (ducks)
Courage and restlessness
Mammalia (mammals)
Cervidae (deer)
Go Ape!
Mammalia (mammals)
Hardy Heron with 5 years of support! Most people wanted Happy/Hungry Hippo Sad :(
Aves (birds)
Released October 2008
Mammalia (mammals)
Released April 2009
(a mythical animal)
Released October 2009
Mammalia (mammals)
clear minded thoughtful predator
Mammalia (mammals)
Felidae (cats)
sabdfl: Meerkats are light, fast and social – everything we want in a Perfect 10
Mammalia (mammals)
Herpestidae (mongooses)
That’s one pretty tusk you got there.
Mammalia (mammals)
part daydream, part discipline
Mammalia (mammals)
Mammalia (mammals)

How To : Install Firefox 6 on Ubuntu without Losing The Old Version

How to

install the new Firefox 6 without losing your old version? Actually,  it’s very easy, but it’s not as easy as in Windows.

1. Go to Firefox Beta download page.
2. Download, and make sure that your file is not corrupted.
3. Extract the source file.

$tar xvf firefox-6.tar.bz2

4. Copy to lib directory

$sudo cp -r firefox /usr/lib/firefox-6

5. Create a link to the executable file

$sudo ln -s /usr/lib/firefox-6/firefox /usr/bin/firefox-6

6. Create a link once again

$sudo ln -s /usr/bin/firefox-6 /usr/bin/firefox6

Ok, the Firefox 6 has been installed on your Ubuntu.
Now, the last step is create a app launcher on your Desktop.
Right click on the Desktop->Create Launcher

Boring with Gnome, LXDE, now tasting KDE Plasma

Setelah mencoba Unity 2D (karena graphic card notebook gw gak support 3D) dan mengalami sedikit kebosanan dengan LXDE yang super duper ringan and extremely fast, gw memutuskan untuk beralih sementara ke KDE. KDE yang gw pilih adalah KDE Plasma yang dulunya merupakan default untuk environment netbook.

Not bad at all….Bisa mengurangi kebosanan gw.

Berikut screenshot KDE gw di Ubuntu 11.04 Natty Narwhal :

Lumayan untuk menghilangkan kebosanan.