Mounting local filesystems in cygwin

If you’re an OS X/Linux geek who also runs Windoze, cygwin is probably installed on at least one of your computers. (On the other hand, if you have no clue what cygwin is, you’re allowed to skip this one.)

I use cygwin for occasional access to GNU utilities like find, and for rsync-based data replication between computers. Given POSIX permissions don’t map to NTFS permissions, this can be problematic. By default, when cygwin writes to NTFS volumes it replaces any existing NTFS permissions with new ones that replicate the effect of POSIX permissions. This is fine for cygwin-only parts of the filesystem, but if you like your NTFS permissions (including, say, ACL inheritance and propagation) and don’t want them to be butchered, you’ll need to mount your filesystems with the noacl option.

Unfortunately, noacl slows down cygwin’s filesystem operations by a factor of… well, lots. I’ve been enduring this for a while now, but I’m glad to have finally found the cause. With noacl enabled, cygwin can’t efficiently determine the executability of files, so it has to read the first few bytes of each file to figure it out. This slows stat down immensely.

The solution? Add exec, notexec or cygexec to your filesystem mount options. These instruct cygwin to treat every file on the filesystem as executable (or not executable). With this line in /etc/fstab, I’m golden:

none /cygdrive cygdrive binary,posix=0,user,noacl,exec 0 0