9

I'm getting mighty tired of having to manually egrep out NFS- and SMB-mounted file systems whenever I am checking on the condition of locally-mounted file systems.

Is there some combination of flags that I can pass to either df or mount that will force them to display only local file systems and skip any and all network-mounted ones?

Peter Mortensen
  • 2,318
  • 5
  • 23
  • 24
ZaMoose
  • 299
  • 1
  • 3
  • 9

2 Answers2

16

df -l. This depends on network filesystems being properly identified as such, though.

geekosaur
  • 7,175
  • 1
  • 20
  • 19
10

The -t and -x flags for df will do what I'm looking for.

-t [type] will list file systems matching filesystem type [type]

-x [type] will list file systems not matching file system type [type]

I.e., for me to exclude NFS-mounted filesystems, the command is df -x nfs.

Peter Mortensen
  • 2,318
  • 5
  • 23
  • 24
ZaMoose
  • 299
  • 1
  • 3
  • 9
  • What are some more possible values of '[type]'? For example, for the loop devices, e.g. `/dev/loop27`? – Peter Mortensen Mar 04 '23 at 12:30
  • 1
    E.g., `df -h -x squashfs -x tmpfs -x devtmpfs` will cut down the output to that of earlier times. – Peter Mortensen Mar 04 '23 at 12:43
  • Or in other words, I suggest ***extending the answer*** to be a little bit more generally applicable, for example, including how that '[type]' information can be located. (But ****** ****** ***without*** ****** ****** "Edit:", "Update:", or similar - the question/answer should appear as if it was written today.) – Peter Mortensen Mar 04 '23 at 12:52
  • OK, the OP has left the building: *"Last seen more than 6 years ago"*. Perhaps somebody is willing to do it? – Peter Mortensen Mar 04 '23 at 12:55