Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use NFS to share media to computers around my house. Unfortunately one of the machines is on a slow wireless link, is there a way to cache network shares on the local disk for performance?

share|improve this question

3 Answers 3

up vote 26 down vote accepted

Stefan led me down the right track. This will work on any system 12.04 and newer.

Your filesystem will also need extended attribute support. If you're using EXT4 you're fine, if you're using EXT3 you'll need to ensure your filesystem is mounted with the user_xattr attribute.

Here's how I set it up on the client machine, you don't need to do anything on the server side.

  1. First, install the user space daemon: sudo apt-get install cachefilesd

  2. Then turn it on by editing /etc/default/cachefilesd and changing the run line to RUN=yes

  3. Ensure your NFS mount in /etc/fstab has an fsc option. Don't forget to remount it after you've made the changes. Here's my excerpt (modify to your needs):

    192.168.1.115:/home/jorge /home/jorge/Backup nfs rw,hard,intr,fsc

  4. Start the service: sudo /etc/init.d/cachefilesd start

Configuration of the cache is done in /etc/cachefilesd.conf, see the references for what the setting options are.

References:

share|improve this answer
    
Does it happen to know how to apply the same on /etc/auto.master ? –  sorin Apr 3 '12 at 9:41

It's not exactly an answer to your question, but...

The best solution for this kind of stuff that I know is using dropbox. You will need an internet connection to upload the md5 hashes to the dropbox server, but after that files will sync over the LAN.

UbuntuOne could be another possibility, but it lacks LAN sync, so changes have to go up using internet and down again.

share|improve this answer
    
Not quite what I am looking for, but thanks! –  Jorge Castro Sep 22 '10 at 17:41

I'm not sure if there is any way to do this currently with Ubuntu 10.04 LTS.

However, the newer versions of the Linux kernel include a feature called FS-Cache & CacheFS, which sounds exactly like what you (and I) want.

Also see Local Caching For Network Filesystems.

share|improve this answer
    
Thanks, it's a great feature. Unluckily it lacks write support :(. –  Javier Rivera Sep 22 '10 at 17:18

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.