Thursday, January 1, 2009

Caching filesystems on linux with fs-cache (cachefilesd)

fs-cache can be use to cache nfs,local or other network filesystems. Here is an example howto cache a nfs mount point on Centos linux distribution. First of make sure that cachefilesd package is installed. Then make sure that cachefilesd (/etc/init.d/cachefilesd) runs on every boot. You can set it to run on startup by chkconfig utility if you like.
Cachefilesd has a config file named /etc/cachefilesd.conf, where you can set where the cache content will be written. The option is called "dir".

eg. dir /cache

Note: caching directory should be an ext3 filesystem.

Let's assume that we have a nfs mount point called mydisk on server Let's create an entry in our fstab for this mount point /mydisk nfs tcp,fsc 0 0

the only option here is "fsc" for letting the caching start. After using check your cache directory in this case our directory is /cache to see it's working. There will be 2 directories there called graveyard and cache. Here is some cache filenames created on my cache directory.


1 comment:

Anonymous said...


Nice post !! thank you ...

- Suman