Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 5 down vote accepted

You can use:

df /path/to/filename

It will show the path base mount point.

share|improve this answer
    
The -h option (df -h) is also useful. – GDP2 Jan 31 at 5:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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