• 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. a2enmod: command not found
  2. ip: command not found
  3. kscreen-doctor : command not found
  4. CentOS / RHEL 7 : How to reinstall GRUB2 from rescue mode
  5. How to configure NTP server and client in CentOS / RHEL 7
  6. Adding static entry into system ARP cache (CentOS/RHEL)
  7. fakeroot Command Examples in Linux
  8. How to check failed or bad login attempts in Linux
  9. ptx Command Examples in Linux
  10. nmap: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright