New mount option "bind"

Corinna Vinschen
Wed Aug 11 13:58:00 GMT 2010

On Aug 11 09:52, Christopher Faylor wrote:
> On Wed, Aug 11, 2010 at 01:36:59PM +0200, Corinna Vinschen wrote:
> >Hi guys,
> >
> >I added a new mount option "bind" which I took from Linux.  It allows to
> >remount an existing POSIX directory into another POSIX directory.  So
> >the path on the left side of the fstab line can be a POSIX path as well.
> >At Cygwin startup, when its added to the mount table, it's converted to
> >a Win32 path using the already existing entries in the mount table to
> >evaluate the path.  So, the path is either relative to a path which
> >preceeds the "bind" path in /etc/fstab, or it's eventually relative to
> >the root dir.
> >
> >The motivation for this was that this allows to specify mount points
> >while retaining relocatability of the Cygwin install tree.  So, even if
> >you don't know in which path the Cygwin installation has been installed,
> >you can do stuff like this now:
> >
> >  $ cat /etc/fstab
> >  /var /usr/var none bind
> >
> >  $ mount
> >  C:/cygwin/bin on /usr/bin type ntfs (binary,auto)
> >  C:/cygwin/lib on /usr/lib type ntfs (binary,auto)
> >  C:/cygwin/var on /usr/var type ntfs (binary,bind)  <<<<<<<<<<
> >  C:/cygwin on / type ntfs (binary,auto)
> >  C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
> >
> >I also updated the docs to describe this new option.  If you find a
> >problem with this option, or if the documentation is not good enough,
> >please feel free to send patches.
> If the mount for /var changes then is that reflected by /usr/var?  I
> believe that's how it works for linux.

No, that doesn't work in Cygwin.  The path is converted to a Win32 path
as soon as it's read from the fstab file or when you call `mount -o bind ...'

Our mount table does not allow to keep the POSIX->POSIX mapping right
now, but we could add that at some point.  OTOH, I think this scenario
is really seldom.  Usually you have the bind entries in fstab and that
doesn't change a lot on the fly.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-developers mailing list