My brain hurts. (Messing with mount.)

Denis Vlasenko vda at ilport.com.ua
Thu Mar 9 07:06:50 UTC 2006


On Tuesday 07 March 2006 17:26, Rob Landley wrote:
> On Tuesday 07 March 2006 1:38 am, Denis Vlasenko wrote:
> > On Monday 06 March 2006 21:55, Rob Landley wrote:
> > > On Monday 06 March 2006 3:31 am, Denis Vlasenko wrote:
> > > > > 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.)
> > > >
> > > > With upcoming kernel support, this will allow making subrees RO
> > > > (or noatime, noexec etc) if you use corresponding mount option.
> > >
> > > Ah.  Cool.
> > >
> > > Mount's always handled "mount blockdev directory" and my version handles
> > > "mount file directory" with an automatic losetup behind the scenes.  I'm
> > > pondering making the "mount directory directory" do an automatic --bind
> > > mount.
> >
> > What will "mount file file" do? Will it also do a --bind mount?
> 
> It'll complain that the target isn't a directory.
> 
> For _any_ mount to make sense, the target must be a directory.  That's part of 
> the definition of mount, everything gets mounted on a directory.

No. mount --bind works on files too:

# echo a >a
# echo b >b
# mount --bind a b
# cat b
a
# mount | grep '/b '
/dev/hda4 on /tmp/b type reiserfs (rw)
# umount b
# cat b
b

--
vda



More information about the busybox mailing list