[lkml]   [2002]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject_reliable_ way to get the dev for a mount point?

Hi all!

I found that in a chrooted environment the /proc/mounts file is
messed up badly. For example, if I do a
chroot /path/to/somewhere
then in the chrooted environment's proc/mounts file will truncate
the /path/to/somewhere string from those mount point it can, and leaves
the rest as they are. (something like s|/path/to/somewhere|| )
Consequently you will have at least two devices showns as mounted to /.
But it can get worse (i know its extreme), if the directory of the
chrooted environment is overmounted.

For example, here's an output from inside the chroot environment:
# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 rw 0 0
none /dev devfs rw 0 0
none /proc proc rw 0 0
none /proc/bus/usb usbdevfs rw 0 0
none /root/chroot1/proc proc rw 0 0
/dev/cdrom / iso9660 ro 0 0
none /proc proc rw 0 0
/dev/hda2 / ext3 rw 0 0

As you can see, there are 3 devices shown as mounted to / (in reality,
only 2 in the chrooted env), and you cannot know from this which of these
3 is your real rootdir.

So, my question is there a way to get back the device for a directory,
_reliably_. (I want to know which devices holds the files my process sees
under an arbitrary /path/to/somewhere).

Balazs Pozsar

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:25    [W:0.066 / U:4.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site