How to determine what filesystem a directory exists on?

I have an NFS share which is shared across about two other machines. I recently realized that one of the servers isn’t sharing the directory and is keeping files all for itself. Is there a way to see if the NFS share is mounted in the directory I think it is in?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Maybe you are looking for

df .

When you are in the directory you want to know the mountpoint of?

Method 2

Straphka idea to use df will work well if you add some flags like the -T that shows filesystem type, (and maybe the -P for posix compability).
And to top it off we can use awk to filter the output so we only print the type output column.

df -PTh . | awk '{print $2}'

or if you like to check up on a dir called smb/media/ in your homedir.

df -PTh ~/smb/media/ | awk '{print $2}'

Method 3

You can use this:

stat -f -c %T .

It outputs nfs, ext2/ext3 or something different.

Method 4

You can use lsblk command as well.

Also, if you want to know things in detail:

$ df -T (file system type)
$ df -h (Humana readable format)

For your question mount -l is the answer as others have said.

Method 5

The command

stat <file-spec> --printf=%m

does the trick.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x