5

Is it possible to query (using the command line) what device a particular file or folder is on?

All files are on some sort of storage device (eg. /dev/sda1). These storage devices are mounted at a particular point in the file system hierarchy (eg. /, /home).

I want to find out what device a file is on. For example, if /dev/sda3 is mounted on /home, given the file ~/document.odt, what command can I use to determine that the file is on /dev/sda3?

6

You can use:

df /path/to/filename

It will show the path base mount point.

  • 1
    The -h option (df -h) is also useful. – GDP2 Jan 31 '16 at 5:07
  • yes -h is very nice ( show in human readable format ) – Scott Stensland Feb 9 '17 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.