Main Menu

Search

Showing posts with label df. Show all posts
Showing posts with label df. Show all posts

LINUX: "df" Command To Find FileSystem / Partition To Which Directory or File Belongs (How To Doc)

Below "df" Command can be used to find the FileSystem / Partition to which directory or file belongs.
df -HT <filename or directory>

For e.g. if you run above df command on /testshare/file-test.out file as follows and lets assume /testshare/file-test.out is file in NFS share.
df -HT /testshare/file-test.out

You will see output as follows which indicates that file-test.out belongs to testshare which is NFS mount.

# df -HT /testshare/file-test.out

Filesystem    Type     Size   Used  Avail Use% Mounted on
10.10.10.5:/export/common/test
               nfs     1.1T   593G   480G  56% /testshare

For e.g. if you run df command on /tmp, you will see output as follows as /tmp is local filesystem.

# df -HT /tmp
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sda2      ext3  8.4G  4.3G  3.6G  55% /



Products to which Article Applies

All Linux Operating Systems

LINUX: How To Find Parent Root Directory Or Mount Point Of Particular File or Directory? ("df" Command)

Below "df" command can be executed to find Parent Root Directory or Mount Point of Particular file or directory.

df -P <filename or directory name>

Below are example outputs of above command.


Example 1:

Below df output shows that test-nfs.out file belongs to NFS share.
# df -P test-nfs.out
Filesystem                                1024-blocks      Used Available Capacity Mounted on
10.10.10.20:/export/common/testshare   524288000 146042240 378245760      28% /testing

Example 2:

Below df output shows that the /var/log directory belongs to / root file system (which is a logical volume)
# df -P /var/log
Filesystem                      1024-blocks    Used Available Capacity Mounted on
/dev/mapper/VolGroup00-LogVol00     6248448 3808448   2440000      61% /


Products to which Article Applies


All Linux environments. 

This Article also applies to other UNIX based Operating Systems as well.

Additional References


http://linuxcommand.org/lc3_man_pages/df1.html