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?

1

2 Answers 2

17

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

3
  • 1
    Super, very straightforward solution.
    – рüффп
    Nov 15, 2018 at 14:09
  • 1
    df -l still shows many loop-devices like /snap/gnome-calculator or /snap/core/
    – maletin
    Apr 1, 2019 at 19:04
  • What does "property identified" mean? Must it have the _netdev mount option, or is it some other detection logic in the background?
    – bviktor
    Nov 26, 2019 at 9:00
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.

4
  • What are some more possible values of '[type]'? For example, for the loop devices, e.g. /dev/loop27? Mar 4, 2023 at 12:30
  • 1
    E.g., df -h -x squashfs -x tmpfs -x devtmpfs will cut down the output to that of earlier times. Mar 4, 2023 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.) Mar 4, 2023 at 12:52
  • OK, the OP has left the building: "Last seen more than 6 years ago". Perhaps somebody is willing to do it? Mar 4, 2023 at 12:55

You must log in to answer this question.

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