Even if I unmount an NFS folder will it still have cached copies of those files from unmount time in that folder?

My understanding is NFS folder once unmounted shouldn't have anything under that folder. That is

ls /mountFolder 

should return empty. Where can I find definitive reference regarding this?

In one of our machines after unmount we stil see files in that folder. Is it cached files or files from old non-NFS filesystem which was there?

  • 2
    it's entirely possible to mount a filesystem onto a mount point that already had files in it. Sounds like that's what's happened here. – Gus Mar 20 '13 at 14:07
  • In addition to what Gus said, you could check that with creating a new file on the NFS-share while it's mounted and then unmounting it. If it isn't there after umounting, you have local copies of the files on the local harddrive. – Alexander Janssen Mar 20 '13 at 14:09
  • Thanks Gus. Could you please pass an authoritative reference about unmount behaviour. I have a hard time convincing my co-engineer. She is within her rights to not trust me till I provide proof! – Fakrudeen Mar 20 '13 at 14:10
  • Fakrudeen: It's in the manual page of mount: "This [mount] tells the kernel to attach the filesystem found on device (which is of type type) at the directory dir. The previous contents (if any) and owner and mode of dir become invisible [...]" And this is what the Solaris manual page says: "mount attaches a file system to the file system hierarchy at the mount_point, which is the pathname of a directory. If mount_point has any contents prior to the mount operation, these are hidden until the file system is unmounted." - it's well defined UNIX behaviour. – Alexander Janssen Mar 20 '13 at 14:12
  • @AlexanderJanssen - this is about mount behaviour. What about unmount? She says it is cached files. I know it is not. But I want proof... – Fakrudeen Mar 20 '13 at 14:14

There's the strong possibility that you had files living in the underlying directory that also serves as the NFS mount point.

This is easy to test. Stop the NFS services (service netfs stop on CentOS/RHEL systems) and see what's in the directory.

I like to make mount point directories immutable with chattr +i /mountpoint so that in the event of a filesystem or network mount disappearing, no data can be written to the mount point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.