Skip to contentSkip to conversation

Quick way to check if file is on nfs?

DISCUSSION Ben Greear 2 participants 2 messages Apr 2, 2014

Subsystems (2)
lore
Share & tools
lore

Ben Greear

author
#0 lore raw

Is there an efficient way to tell if a file we just opened is on NFS vs local disk? We have reports of a bug where our program thinks it has mounted nfs and starts writing to the nfs file system, but later somehow local disk gets filled up instead. I'd like to detect when we are no longer writing to the mount point so I can stop the test, gather logs, etc.

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#1 lore raw
Quoted 9 lines · Ben Greear

Is there an efficient way to tell if a file we just opened is on NFS vs local disk? We have reports of a bug where our program thinks it has mounted nfs and starts writing to the nfs file system, but later somehow local disk gets filled up instead. I'd like to detect when we are no longer writing to the mount point so I can stop the test, gather logs, etc.

Thanks,
Ben

Call fstatfs() on the file descriptor and look at the returned f_type?

Cheers
Trond

_________________________________
Trond Myklebust
Linux NFS client maintainer, PrimaryData
[email protected]