How to find the partition of hard disk belonging to a specific file?

How to check to which partition a particular file belongs?

Following procedure will guide you to discover that partition on which a “file” resides.

We do this with the help of df command. It is used get a report of space utilized on disk and also mentions files/directories.

This command is used as follows:

$ df
$ df /etc/TestDirectory
$ df /etc/TestFile

df can be followed by any path to desired location. Lets understand with an example, we are here finding out location of /etc/gtk-2.0/

$ df -T /etc/gtk-2.0/

This command generates an output which looks like following:

Filesystem   Type 1K-blocks Used    Available Use% Mounted on
/dev/sda7    ext4 18141972  9862580 8095148   55%  /



About the author

Yet another geek!