Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm switching to Cygwin from the bash shell that ships with Git for Windows, and encountering a strange problem. Someone thought it would be a good idea to add /cygdrive/ to all paths, while I think it's a horribly ugly idea. I've been able to determine that I can partially fix this by adding

mount --change-cygdrive-prefix /
export HOME=/c/Users/BZISAD0

in my .bashrc, but if I take a look at the PATH variable, everything still has /cygdrive/ in it. I suppose I could write a script to fix the PATH but that's even more kludgey than what I'm already doing. There's got to be a better way, and I'm pretty confident there is since Git's bash shell uses (AFAIK) an older version of Cygwin, and it's somehow configured to not prepend /cygdrive everywhere. So, how can I turn the "Suck" knob to zero?

Gary Larson comic

share|improve this question

3 Answers 3

up vote 19 down vote accepted

Grepping around in /etc turned up a link that Googling did not. It turns out you can control this in the file /etc/fstab. Just add a line that says

none / cygdrive binary 0 0

and the problem should be fixed. No more kludgey fixes in .bashrc, and no messed-up $PATH.

share|improve this answer
    
I used this method, and now when I try to do ls /, the windows drives don't appear. Not even when using ls -l /. Is this expected? Can it be fixed? This is what I have in fstab: none / cygdrive binary,posix=0,user,acl 0 0 –  Tibi Jul 8 at 13:44
    
I didn't know there was a way to get the windows drives at /. Did you have that before? (Or at /cygdrive/?) I've always just lived with the fact that I have to know which Windows drives are available, and I hardly ever use them anyway. –  iconoclast Jul 8 at 15:49
    
I don't really know... I never tried it before. –  Tibi Jul 18 at 8:07
    
Yes, ls /cygdrive should list the Windows drives. The output for me, for example, is c/ e/ f/. Note how drives are treated like folders. –  Mike Oct 13 at 4:05

Method one

mount -c /
mount -m > /etc/fstab

Method two

echo - / cygdrive acl > /etc/fstab

Example

share|improve this answer

Yes, mount should work.

mount -c /

If you still have entries in PATH that refer to /cygdrive, then you probably just need to reboot.

Also, check if there are any PATH settings in /etc/profile that refer to /cygdrive.

share|improve this answer
    
You mean restart Cygwin, or actually reboot the whole machine? –  iconoclast Aug 3 '12 at 16:40
    
I think you need to terminate all Cygwin-based processes. The easiest way to do this is to reboot the machine. –  Mikel Aug 3 '12 at 17:23
    
I normally give preference to other people's answers when I find answers to my own questions, but since yours requires a reboot (or simulation thereof) and since mine is the one found in cygwin's documentation, I'm going with mine. –  iconoclast Aug 13 '12 at 18:07
    
If yours worked without a reboot, then by all means! –  Mikel Aug 13 '12 at 18:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.