Find out what filesystem a file or directory is part of

I have a lot of filesystems:

  • / on a PCI-E SSD
  • swap on a SATA SSD
  • /media/ned is a RAID5 array
  • /tmp lives on RAM
  • Parts of /home/oli are symlinked and bind-mounted in from ned
  • I also have /media/jeff/ which is RAID1 that I store backups and bind-mount ~/.wine in off.

It's actually a lot more complicated than that. There are all sorts of extra symlinks that I need to untangle in the long run but for now I just need a nice way of taking a path and finding out where it physically lives.


This is not probably the best or the correct answer, but df can do it:

javier@todocolor:~$ df /boot/grub/
S.ficheros         Bloques de 1K   Usado    Dispon Uso% Montado en
/dev/sda2               918354    184202    685154  22% /boot
javier@todocolor:~$ df .
S.ficheros         Bloques de 1K   Usado    Dispon Uso% Montado en
/dev/md0              75532064  13930424  57795044  20% /

Take the first and the last column.


df /path/to/filename    # to find out what device a file or folder is on