unmounting multiply-mounted directories

From: David Madore (david.madore@ens.fr)
Date: Mon Mar 03 2003 - 19:53:20 EST


Hi all.

I use devfs on my installation, even though my distribution
(RedHat-7.3) does not endorse it. Most of the time it works fine.
However, when I want to upgrade certain packages (for example, that
which contains the entries in the non-devfs /dev directory) I need to
make the original /dev directory visible to the package management
(viz. rpm) program.

Seeing that I cannot unmount the devfs /dev directory since many
processes use it, I figured the best way to do that would be to
temporarily mount the original /dev directory in its place and over
it, and then unmount it. So I did something like this

mount /dev/sda2 /mnt/bareroot
mount --bind /mnt/bareroot/dev /dev
rpm -U whichever-package-needs-to-access-dev.whatever.rpm

This worked fine. Unfortunately, I then discovered that I couldn't
unmount the /dev directory! I get this:

vega root ~ # umount /dev
umount: /dev: device is busy
umount: /dev: device is busy

Hum, why am I getting the error message twice? Is it because I have
two different mounts on the same /dev mountpoint?

Anyway, I would like to trace that "device is busy" error back to its
causes, that is, determine which processes are preventing me from
unmounting the topmost /dev mount. How do I do that? I tried using
fuser but it is useless: it does not have an option to distinguish
open files from the bottommost /dev mount and from the topmost. So
how should I distinguish the two?

Actually, all sorts of weird things are happening now. For example,
the /dev/pts directory is all empty (that doesn't seem to bother xterm
overmuch, though, even if I open new xterms). Well, I guess I'm in
for an emergency reboot.

But, what would be The Right Way to make the old /dev accessible to a
program that needs to access it? I can think of running the program
chrooted with a specially mounted / but it doesn't seem perfect
either. Any other ideas?

Oh, and by the way: is there some documentation to mount --bind
somewhere? Like, something which explains the detailed semantics of
that operation?

Thank you for your help -

-- 
     David A. Madore
    (david.madore@ens.fr,
     http://www.eleves.ens.fr:8080/home/madore/ )
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Mar 07 2003 - 22:00:23 EST