Friday, March 3, 2017

How to mount NFS on Ubuntu 12.04 with caching support


1 Install packages

sudo apt-get install nfs-common 
sudo apt-get install cachefilesd

2 File system setup

Your filesystem will 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. To check your filesystem type, you could use:
$ df -h -T
Filesystem         Type      Size  Used Avail Use% Mounted on
/dev/sda1          ext4      912G  816G   50G  95% /
Then you need to create a local directory which will be mounted with the NFS export.
$ mkdir /media/test
$ chmod 777 /media/test

3 Enable cachefilesd 

edit /etc/default/cachefilesd and changing the run line to RUN=yes

4 Ensure your NFS


mount in /etc/fstab has an fsc option. For example:
192.168.110.150:/nsf/test /media/test nfs rw,hard,intr,fsc


5 Remount 


with "mount -a"

6 Start the cachefilesd service


sudo /etc/init.d/cachefilesd start

7 Edit the configuration of the cachefilesd 


in /etc/cachefilesd.conf.

Reference

http://askubuntu.com/questions/4572/how-can-i-cache-nfs-shares-on-a-local-disk
http://xmodulo.com/how-to-enable-local-file-caching-for-nfs-share-on-linux.html

No comments: