Getting at fsid under Linux? Or an alternate way of identifying filesystems?

Posted by larsks on Server Fault See other posts from Server Fault or by larsks
Published on 2012-03-20T02:33:34Z Indexed on 2012/03/20 5:31 UTC
Read the original article Hit count: 556

Filed under:
|
|

In an environment with automounted home directories, such that the same filesystem exported by a fileserver may be mounted multiple times on the client, I would like to authoritatively be able to identify whether two mountpoints are in fact the same filesystem. That is, if the remote server exports:

/home

And the local client has:

# mount
fileserver:/home/l/lars on /home/lars type nfs (rw...)
fileserver:/home/b/bob on /home/bob type nfs (rw...)

I am looking for a way to identify that both /home/lars and /home/bob are in fact the same filesystem. In theory this is what the fsid result of the statvfs structure is for, but in all cases, for both local and remote filesystems, I am finding that the value of this structure member is 0.

Is this some sort of client-side issue? Or do most modern NFS servers simply decline to provide a useful fsid?

The end goal of all of this is to robustly interpret the output from the quota command for NFS filesystems. For example, given the example above, running quota as myself may return something like:

Disk quotas for user lars (uid 6580): 
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
otherserver:/vol/home0/a/alice
                     12  52428800 52428800               4  4294967295 4294967295        
fileserver:/home/l/lars
                9353032  9728000 10240000          124018       0       0        

...the problem here being that there exists a quota for me on otherserver which is visible in the results of the quota command, even though my home directory is actually on a different device. My plan was to look up the fsid for each mountpoint listed in the quota output and check to see if it matched the fsid associated with my home directory.

It looks like this won't work, so...any suggestions?

© Server Fault or respective owner

Related posts about linux

Related posts about nfs