Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have a Linux server that reads files from a network drive and processes them. In a common scenario, a user will log in and access the same files over and over again. The size of the files varies but the larger ones can be around 50+ Mb. The files seldom change.

I was wondering if it's somehow possible to transparently cache the files. I don't want (or can) change the program the reads the files, nor do I control the protocol by which the files are accessed. I just want something to detect that I access a certain path, copy the file locally (if needed) and then read the file from the local drive.

I've read about Bcache but can't figure out if it's what I need.

Do you have any suggestions?

Thanks, Vadim.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Look into cachefilesd. It works almost automatically. All you need to do is this:

  1. Create an ext3 filesystem on the client to house the cache. Put it on whatever local media you want (dedicated partition, LVM LV, etc...) and make it whatever size you want the cache to be.

  2. Mount this filesystem on /var/cache/fscache. Put it in /etc/fstab so it will always mount at boot time.

  3. Install cahefilesd (Debian package cachefilesd)

  4. I think this is the default already, but make sure dir is set to /var/cache/fscache in /etc/cachefilesd.conf.

  5. Add "fsc" to the mount options of the filesystems for which you want to enable the cache. For example: "rw,hard,fsc". Unmount and remount these filesystems.

share|improve this answer
    
Thanks. Is it also possible on Red Hat? –  Vadim Jul 9 '12 at 14:44
    
Sure, I imagine it is perfectly possible on Red Hat! –  Celada Jul 9 '12 at 17:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.