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?
Ubuntu – How to cache NFS shares on a local disk
nfs
Related Question
- Ubuntu – Mounted NFS shares interrupting shutdown
- Ubuntu – What happens to LDAP user authentication and NFS home directory shares when away from the network
- Ubuntu – Setting up NFS client shows “local domain name not set” error
- Ubuntu – How to share an optical drive in a way that fools the client into thinking it’s a local drive
Best Answer
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.
First, install the user space daemon:
sudo apt-get install cachefilesd
Then turn it on by editing
/etc/default/cachefilesd
and changing the run line toRUN=yes
Ensure your NFS mount in
/etc/fstab
has anfsc
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 fsc
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:
/usr/share/doc/cachefilesd/howto.txt.gz
/usr/share/doc/cachefilesd/README.gz