Mount Confusion -- the tallest pique in the world? ;-)

Lee D. Rothstein lee@veritech.com
Sat Nov 1 18:39:00 GMT 2003


At 2003-10-31 01:08 PM, Igor Pechtchanski wrote:
>On Thu, 30 Oct 2003, Lee D. Rothstein wrote:
>
>> Either Cygwin or I be confused. (I'm betting on "I". ;-))
>
>Bingo.
>
>> I have deleted '/tmp' ('d:/Cygwin/tmp' -- using Explorer)
>> and issued: 'umount /tmp' and 'mount 'e:\tmp /tmp' repeatedly.
>                                                     ^^^^^^^^^^
>Umm, why?  Once should have been enough.
>
>> All the other mounts to '/' appear in an 'ls' of '/',
>> but '/tmp' ('e:/tmp'), does not.
>
>What other mounts to "/"?  "/" itself is a mount, but under it everything
>should be either a real or virtual (/proc, /dev) directory.

/zc -- c:/
...
/zy -- y:/

Why do /zc, /zd, /ze, /zf, /zg, ... ('mount c:/ /zc', ...
'mount g:/ /zg, ...) appear in ls output when no prior
'mkdir's have been carried out. What's different between
/tmp and /<everything else>?


>> Prior to my doing any of the above (w/ Cygwin root at
>> 'c:/_Programs/Cygwin'), I've had recurring instances of something
>> (apps?, 'setup.exe?, what?) creating 'tmp' and more frequently 'var' on
>> both my 'c:' and 'e:' drives. This problem seems to have subsided since
>> I moved the Cygwin root directory from 'c:/_Programs/Cygwin' to
>> D:/Cygwin'.
>
>I'd bet you were installing as one user and running as another.

You'd lose that bet. Only one ID -- Administrator. Cygwin always
*only* installed for/by Administrator.

One thing I do not understand, however, is the appearance of the
owner/user SYSTEM on some files/directories when I do 'ls -l'. 

>> Also, after I moved Cygwin, despite changing all the references in the
>> profile and Windows environment variables, *and* reinstalling the whole
>> of Cygwin, "Cygwin" "insisted" on looking at the C/_Programs... : root
>> rather than the D:/Cygwin... directory
>>
>> Anybody know what's causing this?
>
>Stale user mounts?  Your "/", "/usr/bin" and "/usr/lib" mounts appear to
>be user mounts.  You should probably remount them as "system" (i.e.,
>'mount -f -s -b d:/Cygwin /', 'mount -f -s -b d:/Cygwin/bin /usr/bin',
>'mount -f -s -b d:/Cygwin/lib /usr/lib', and 'umount -U').

This was most helpful. To have a copy of the wisdom expressed above
for future reference, I have written the following script:

#!d:/Cygwin/bin/bash
#
# ^Use absolute[ly brain dead (MS)] paths until mounts are corrected
#
# 'mountproperly' -- This script is only required if Cygwin 'setup.exe'
#                    configuration gets screwed up WRT mounted directories,
#                    I.e., Initialize all mounts to their desired parameters
#
# 2003-10-31 -- as per Cygwin List/Igor Pechtchanski <pechtcha@cs.nyu.edu>
#

do1 () { # Make sure each drive/directory is mounted with the correct
         # parameters:
  d:/Cygwin/bin/umount            $2  # 1st, unmount everything
  d:/Cygwin/bin/mkdir             $2  # 2nd, make a directory representation
       # in the virtual root directory so that certain directories can show
       #  up at all as virtual directories (e.g., '/tmp')
  d:/Cygwin/bin/mount -f -s -b $1 $2  #  -f, force mount, don't warn about
       #     missing mount point directories
       # -s, (default) add system-wide mount point; Lee: necessary? Default!
       # -b, (default) text files are equivalent to binary files
       #     (newline = \n) Lee: necessary? It is the default.
}

d:/Cygwin/bin/umount -U # Unmount all user mounts. We want all mounts as
                        # system mounts, because ?
do1 d:/Cygwin /
d:/Cygwin/bin/mount -s -b -c /  # -c -- change the cygdrive path prefix
     # to / . This doesn't work? 'ls /c', nor 'ls //c', for example, does
     # not list the c: drive! What am I not getting?
do1 d:/Cygwin/bin /usr/bin # any others, missing, here?
do1 d:/Cygwin/lib /usr/lib

mkdir /proc # Allows 'ls' & 'cd's to this virtual directory/information
mkdir /dev

for drive in c d e f g h x y a s # Drive mount points don't need actual
                                 # directories to show up in 'ls' output
                                 # for some reason. Why are these
                                 # different from '/tmp'?
  do
  umount ${drive}:/
  mount -f -s -b ${drive}:/ /z${drive}
  done

mount # See the corrected mounts
------------------------------------------------------------------

>Also, your system cygdrive prefix is marked "textmode"; you should change
>it to "binmode" to avoid spurious errors (by 'mount -s -b -c /').  It's
>not very safe to have it set to '/' anyway...

Please note that in the above script ('mountproperly'), I have tried
to include the advice of the above sentence, but it occurs to me that
I'm having trouble with the referents in the sentence.

As far as I know, my only cygdrive prefix is 'cygdrive'. Are you
saying it's also '/'? Note that in the script I am doing a
'mount -s -b -c /'. That's what you are advocating?

Should this be written up for the FAQ?

>Oh, and another small thing:
>
>cls = `() {  cmd /c cls
>}'
>
>Why not install the "clear" package and 'function cls() { clear }'? ;-)
>        Igor

Artifact of a past limitation of 'clear'. It used to only clear the
screen and not the screen buffer, as well. Now, it clears both.
('cls', of course, never worked with 'rxvt'.)



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list