My brain hurts. (Messing with mount.)
Rob Landley
rob at landley.net
Sun Mar 5 17:07:15 PST 2006
There is no mount spec. Only endless questions.
It is possible to --bind mount a directory onto itself. (Oddly, the system
survived. It seems to be a NOP, I could still list the contents of the
directory, but it shows up in /proc/mounts.)
Judging by what the gnu one does for "mount -a /dev/hda" and "mount
-a /dev/hda /thingy", the -a should be silently dropped when you supply
blockdev and/or directory arguments.
When to take absolute paths of things and when to preserve relative paths is
confusing. (Yes, you can have relative paths such as "../woot" in fstab.)
Some things (calling losetup ioctls, creating an entry in /etc/mtab) insist
on an absolute path. Other times the "blockdev" argument is a comment, or
something else entirely (such as a network address, or an MTD device
identifier) and taking the absolute path would screw things up. For
iterating through /etc/fstab, I need to check for matches against _both_,
because /etc/fstab doesn't just have /dev/hda1, it can also have something
like:
walrus.img walrus ext2 loop,ro
Which can be mounted via:
mount walrus.img
But not via:
mount ./walrus.img # Still expects "walrus" in the current directory...
Oddly, after mounting that, I can umount ./walrus.img and it works.
When you supply two arguments, mount doesn't check fstab at all. With the
above fstab entry:
mount walrus.img walrus
The mount is rw, not ro, and I have to say -t ext2 -o loop with the gnu
mount.
"mount -o remount,rw" does require at least one argument.
Using the above fstab entry, and doing this:
mount walrus.img walrus
mount -o remount,rw walrus
Complains that block device walrus.img is write protected, and it's mounting
read only. (Understandable, since it did a read-only association on the
loopback device.)
Following up with
mount -o remount,rw /dev/does-not-exist walrus
Complains that /dev/does-not-exist is mounted read only. Amusing. :)
Ooh, if I add an entry:
/path/to/walrus.img potato ext2 loop,rw 1 2
Then _that_ always resolves the paths, and can be mounted via a relative path.
(In fact if _both_ are in there, that one wins even if it's after the first
one. Strange.) Right, my brain hurts.
I consider "mount -t procfs /dev /proc" and then trying to umount /dev to be a
"doctor, it hurts when I do this" case.
Apparently, when you mount a symlink on another symlink, the kernel
dereferences both for you, which makes sense I suppose. (Of course this is
another case where /etc/mtab can get confused...)
Dinner time.
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list