32

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?

1
  • mount -l works ;) Sep 12, 2011 at 21:16

5 Answers 5

58

Maybe you are looking for

df .

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

3
  • 3
    +1 if you add mount -l to your answer ;) Sep 12, 2011 at 21:17
  • @TK Kocheran The mount command is another way to find out, but then you probably should do "mount -l | grep XXX" so you filter the output a little, and still you may have ambiguous output (if you have dirs with similar names). The df command will tell you where the current dir is mounted and what type so there is not ambiguity in this method. But the result should be the same...
    – Johan
    Sep 13, 2011 at 8:13
  • See also that recent discussion on the austin-group mailing list that mentions corner cases where it may not work. Nov 3, 2017 at 9:40
12

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}'
11

You can use this:

stat -f -c %T .

It outputs nfs, ext2/ext3 or something different.

5

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.

5

The command

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

does the trick.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .