EnhanceIO SSD Caching in Ubuntu 13.04

EnhanceIO is a SSD caching technique for Linux. It is not in the Ubuntu 13.04 repositories, so one has to install from source.

Although EnhanceIO supports caching of root, you may consider to put your root on a different SSD partition and only cache the /home partition. This will be much faster than caching the whole device. Also be warned that a system crash could destroy your system partition if cached with the write back method. The default write through is much safer.

I am going to use DKMS for compiling and installing the modules. DKMS automatically recompiles after kernel update. However one can still compile the complete kernel, but keep in mind that kernel is updating frequently.

Prerequesites

sudo apt-get install build-essential dkms 

(you may need more like the kernel sources (sudo apt-get install linux-source) )

Install

Get the source

git clone git@github.com:stec-inc/EnhanceIO.git 

Enter the folder.

cd EnhanceIO

Switch to the right branch for the 3.9 or previous kernel if needed.

git checkout 3.9-kernel

Copy enhanceio command line interface and documentation into the right place

sudo cp CLI/eio_cli /sbin/
sudo chmod 700 /sbin/eio_cli
 
sudo cp CLI/eio_cli.8 /usr/share/man/man8

Copy it to the Kernel source tree

cd Driver
sudo cp -r enhanceio /usr/src

Rename it to a version, I recommend to use the last commit date as in git log.

sudo mv /usr/src/enhanceio /usr/src/enhanceio-0+git20130618

Change the dkms config file

cd /usr/src/enhanceio-0+git20130618
sudo vim dkms.conf

Change the version respectively and save.

PACKAGE_VERSION="0+git20130618"

Add the driver to Dkms and let it now build with every new kernel version coming. Using DKMS one can later switch back easily to an older driver version if desired.

sudo dkms add -m enhanceio -v 0+git20130618 
sudo dkms build -m enhanceio -v 0+git20130618
sudo dkms install -m enhanceio -v 0+git20130618

finished and reboot!

Usage

Get info

sudo eio_cli info

Create the cache Use your values! Don't just copy!

sudo eio_cli create -d /dev/disk/by-uuid/bc4ae082-85d1-43f4-a3fc-4ea8982c3fc8 -s /dev/sdd -c cache_root

Creates a cache of spinning drive bc4ae082-85d1-43f4-a3fc-4ea8982c3fc8 named cache_root using whole SSD /dev/sdd. One can also use partitions. To get the UUID of the spinning drive use blkid.

Get status

cat /proc/enhanceio/cache_root/stats
reads                    No of reads on the cache
writes                    No of writes on the cache
read_hits               No of cache read hits
read_hit_pct           Percentage of read hits, best would be to have 100%
write_hits               No of cache write hits
write_hit_pct          Percentage of write hits

Updating EnhanceIO

For updating EnhanceIO just do all steps like for installation. Just make sure to name it after the new version. DKMS will automatically uninstall the old version of EnhanceIO if one installs a new version.

sudo dkms status

Will give you an overview about the installed version and the other available versions. If one wants to get rid of the old version use dkms remove.

Ending caching

Make sure that cache wrote all data to disk. Keep in mind to chance the cache name "cache_root" to your used name.

cat /proc/enhanceio/cache_root/stats | grep nr_dirty

If this is not 0, which can be in case of a write cache, do the following. Then check again.

sudo eio_cli clean -c cache_root

If the stats for nr_dirty are 0, one can delete the cache by:

sudo eio_cli delete -c cache_root

Comments

I have struggled with Flashcache for several hours (and nearly ruined my rootfs). Many thanks to your article about EnhanceIO. It works!

Thank you for this tutorial. It worked for me without a hitch.

Can you please add some information about the stats in /proc/enhanceio/cache_root/stats? I guess that "read_hits_pct" is the percentage of read hits, right? For me it stays at 0 (I got like 8 read_hits for for more than a million reads). The funny thing is, that "write_hits_pct" is 20!

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
oxyhydrogen-psychologica