Question about mount
Rob Landley
rob at landley.net
Mon Mar 27 18:31:21 UTC 2006
On Monday 27 March 2006 5:50 am, Alexander Griesser wrote:
> Jean Wolter wrote:
> >> In previous busybox releases I could do the following:
> >>
> >> mount -n -o remount,rw /
> >
> > The following works here with 1.1.1
> >
> > busybox mount -o remount,rw /dev/root /
>
> Ah, ok, that works here for me too, thank you.
That's a different codepath.
> Today I spent quite some time reading the mount sourcecode and
> I think I found code that should do the following:
>
> If mount gets only one parameter, it is the directory where the
> filesystem has to be mounted -> the mountpoint.
> If so, check /etc/fstab to get all other credentials for this
> mountpoint and finally do the mount.
For remount, it should check /proc/mounts. (Or /etc/mtab if you built the
thing to maintain its own mtab. I didn't extensively test maintaining your
own mtab because it's only relevant if you have no /proc directory.)
> If the mountpoint can't be found in /etc/fstab, try to mount
> the last entry in /etc/fstab and that is exact that, what happens.
I don't understand what you're trying to say here.
It takes the last of multiple matches because in /proc/mounts you can
overmount the same mount point multiple times, and the last one is the one
you want. (And in /etc/fstab, there shouldn't be duplicates but if there
are, the standard mount takes the last one. I checked.)
> The following behaviour is really strange, at least some parts
> of the output are definetly wrong:
>
> My fstab:
>
> [lxtc3861 - ~ #] cat /etc/fstab
> # /etc/fstab: static file system information.
> #
> # <file system> <mount point> <type> <options> <dump>
> <pass>
> /dev/hda3 / ext3 defaults 0 0
> proc /proc proc defaults 0 0
> tmpfs /var/tmp tmpfs defaults,size=100M 0 0
> none /proc/bus/usb usbfs defaults 0 0
> /dev/hda1 /system ext3 defaults 0 0
>
> Currently mounted filesystems:
>
> [lxtc3861 - ~ #] mount
> /dev/root on / type ext3 (rw)
> proc on /proc type proc (rw,nodiratime)
> sysfs on /sys type sysfs (rw)
> none on /proc/bus/usb type usbfs (rw)
> devpts on /dev/pts type devpts (rw)
> tmpfs on /var/tmp type tmpfs (rw)
>
> I can mount and unmount /system (/dev/hda1) with the following
> commands:
>
> [lxtc3861 - ~ #] mount /system
> [lxtc3861 - ~ #] umount /system
>
> But if I try to mount / I get the following error:
>
> [lxtc3861 - ~ #] mount /
> mount: Mounting /dev/hda1 on /system failed: No such device
> [lxtc3861 - ~ #]
Out of morbid curiosity, how did you get here without / already mounted?
I notice that if you try to mount something in two places with different
flags, the kernel sometimes gives strange error messages when refusing to do
so. However, if you have something mounted in just one place, -o remount,rw
should work.
> According to the output, mount tries to mount /dev/hda1 on /system and
> that should work, according to my previous try.
>
> 'umount /' "works" as it does mount the root-filesystem readonly.
That's a fallback behavior.
> As /dev/root does not exist on the filesystem I assume its value is
> derived from the root= kernel boot parameter, right?
> That would definetly solve my problem then...
Ah, I hadn't spotted the /dev/root!
Ok, the behavior to look up /dev/root was taken out. Instead mdev grew an
extra function, when populating /dev it creates a symlink from /dev/root to
your real root device (if there is one). If your real root device is nfs or
ramfs or some such, we could never do anything intelligent with this anyway.
If you're not using mdev, and you want to have /dev/root in your fstab, you
need /dev/root in your /dev as well. Make a symlink to your real root
device.
> But the above behaviour seems strange to me.
>
> ciao,
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list