Code44free's Blog

Ubuntu 12.04 EnchanceIO SSD caching + perfomance tips

Posted in linux by code44free on December 30, 2013

For better linux system performance:

1. Putting to ram /tmp filesystem and .cache forlder from user /home
2. Make separate root partiotion (/), separate home partition (/home) and enable for it EnchanceIO SSD caching. Make also separate partition for /var, for excluding it from caching.

In my example /dev/sda 500GB hard disk, /dev/sdb 32GB SSD disk.

After the initial installation of ubuntu system, my partition table look like this:

/dev/sda1       188M  2,1M  186M   2% /boot/efi
/dev/sda2        37G   12G   24G  34% /
/dev/sda4       3,7G 1002M  2,6G  29% /var
/dev/sda5       414G   72G  322G  19% /home

Add to /etc/fstab two extra lines. In this example /home/alex is my home folder

tmpfs	/tmp	tmpfs	defaults,noatime,nosuid,size=100M	0	0
tmpfs	/home/alex/.cache	tmpfs	defaults,noatime,nosuid,size=200M	0	0

After reboot, /tmp and /home/alex/.cache will be located in RAM. That will have a good impact for the performance.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        37G   12G   24G  34% /
udev            3,9G   36K  3,9G   1% /dev
tmpfs           100M   56K  100M   1% /tmp
tmpfs           1,6G  884K  1,6G   1% /run
none            5,0M     0  5,0M   0% /run/lock
none            3,9G  3,4M  3,9G   1% /run/shm
/dev/sda4       3,7G 1002M  2,6G  29% /var
/dev/sda5       414G   72G  322G  19% /home
/dev/sda1       188M  2,1M  186M   2% /boot/efi
tmpfs           200M   90M  111M  45% /home/alex/.cache

For enable SSD caching make the following steps:
1. In SSD drive, i create partition /dev/sdb1 with size 10GB for root (/) caching and /dev/sdb2 with size 22GB for home partition caching.
2. Install packages needed for kernel compile.
3. Take latest kernel source from site
4. Getting latest EnchanceIO source code from its git repository.
5. Patching, configuring and compiling kernel.
6. Enable SSD caching.

# Install packages needed for kernel compile
$ sudo apt-get install kernel-package fakeroot build-essential ncurses-dev

# Install GIT
sudo apt-get install git

# Getting latest kernel source code and untar it to /usr/src
$ cd ~/Downloads
$ wget
$ cd /usr/src
$ sudo tar xJf ~/Downloads/linux-3.12.6.tar.xz

# Getting latest EnchanceIO source code, putting it to /usr/src
$ sudo git clone git://

# Patching kernel
$ sudo cp -pR /usr/src/EnchanceIO/Driver/enhanceio /usr/src/linux-3.12.6/drivers/block/
$ cd /usr/src/linux-3.12.6/
$ sudo patch -p0 < /usr/src/EnchanceIO/Driver/config.patch

# Configuring kernel
# Enable EnchanceIO in Device Drivers --> Block Devices --> Enable EnchanceIO
$ sudo make menuconfig

# Compile kernel
$ sudo fakeroot make-kpkg -j8 --initrd kernel_image kernel_headers

# Install kernel
$ sudo dpkg -i ../linux-image-3.12.6_3.12.6-10.00.Custom_amd64.deb ../linux-headers-3.12.6_3.12.6-10.00.Custom_amd64.deb 

# Reboot system with new kernel and check 
$ uname -r

# Copy EnchanceIO cli utility and man page
$ sudo cp /usr/src/EnhanceIO/CLI/eio_cli /sbin
$ sudo chmod +x /sbin/eio_cli
$ sudo cp /usr/src/EnhanceIO/CLI/eio_cli.8 /usr/share/man/man8/

# Setup caching for home partion /dev/sda5 -> /dev/sdb2 
# (look for partition tables above)
$ sudo /sbin/eio_cli create -d /dev/sda5 -s /dev/sdb2 -m wt -b 4096 -c sda5 -p lru

# Setup caching for root partion /dev/sda2 -> /dev/sdb1
$ sudo /sbin/eio_cli create -d /dev/sda2 -s /dev/sdb1 -m wt -b 4096 -c sda2 -p lru

# eio_cli automatically generated rule files for udev
$ ls -all /etc/udev/rules.d/
-rw-r--r-- 1 root root 2868 Дек 26 18:22 94-enhanceio-sda2.rules
-rw-r--r-- 1 root root 2868 Дек 26 18:18 94-enhanceio-sda5.rules

# Check that caching is enabled
$ cat /proc/enhanceio/sda2/stats 
$ cat /proc/enhanceio/sda5/stats 

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: