• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to disable NFS client caching in CentOS/RHEL

by admin

Occasionally the NFS Client does not read data from NFS exports synchronously, such as when it was written by another NFS Client. For example, after NFS Client A writes a file by “echo hello > /NFS_mountpoint/testfile”, NFS Client B can not read the file with “No such file”, or can read but the contents of the file could be old one.

NFS Clients caches various NFS data. RFC 1813 for NFSv3 specification says:

Clients can perform caching in varied manner.

and also says:

The NFS version 3 protocol does not define a policy for
caching on the client or server. In particular, there is no
support for strict cache consistency between a client and
server, nor between different clients.
Therefore this is designed behavior of Linux NFS client.

Therefore this is designed behavior of Linux NFS client. Disable/skip NFS client caching by configuring NFS client mount options, or read/write the data with O_DIRECT/O_SYNC.

To disable all caches for NFS client, add “sync” for mount option, ex.

# mount -t nfs -o vers=3,sync NFS_Server:/NFS_Export/ /NFS_Mountpoint
Note: This option may bring about a degredation of performance. Test this option carefully on your test system before applying this on a production system.

To disable caching directory entries by NFS client, add “noac,lookupcache=none” for the mount option, such as in the following example:

# mount -t nfs -o vers=3,noac,lookupcache=none NFS_Server:/NFS_Export/ /NFS_Mountpoint
Note: There are differences between noac and actimeo=0. actimeo=0 can cache attribution changes, but noac does not. Thus noac is safer than actimeo=0 however it can have an impact on performance. It is also okay to set both options, to further restrict this.

Filed Under: CentOS/RHEL, Linux

Some more articles you might also be interested in …

  1. How to install/remove/query/update RPM packages in Linux (Cheat Sheet)
  2. How to Disable user list on GNOME login screen in CentOS/RHEL 8
  3. Tutorial on Linux Clustering (High Availability)
  4. What is the purpose of “mysql.sys@localhost” user
  5. Understanding /etc/login.defs file
  6. Linux OS Service ‘setroubleshoot’
  7. Unmounting a Windows Share Fails in Linux
  8. What is ioremap()
  9. How to Check CentOS Version
  10. head Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright