How to enable local file caching for NFS share on Linux

submited by
Style Pass
2021-06-22 13:30:04

If you often mount and access a remote NFS share on your system, you will probably want to know how to improve NFS file access performance. One possibility is using file caching. In Linux, there is a caching filesystem called FS-Cache which enables file caching for network file systems such as NFS. FS-Cache is built into the Linux kernel 2.6.30 and higher.

In order for FS-Cache to operate, it needs cache back-end which provides actual storage for caching. One such cache back-end is cachefiles. Therefore, once you set up cachefiles, it will automatically enable file caching for NFS shares.

One requirement for setting up cachefiles is that local filesystem support user-defined extended file attributes (i.e., xattr), because cachefiles use xattr to store extra information for cache maintenance.

However, if you are using EXT3 filesystem, then you need to mount the local filesystem with user_xattr option. To do so, edit /etc/mtab to add user_xattr mount option to the disk partition that will be used by cachefiles for file caching. For example, assuming that /dev/hda1 is such a partition:

Leave a Comment