mount — Display information about mounted filesystems, or mount a filesystem
mount [-f] [-o
POSIXPATH | -p
mount -h | -V
-a, --all mount all filesystems mentioned in fstab -c, --change-cygdrive-prefix change the cygdrive path prefix to <posixpath> -f, --force force mount, don't warn about missing mount point directories -h, --help output usage information and exit -m, --mount-entries write fstab entries to replicate mount points and cygdrive prefixes -o, --options X[,X...] specify mount options -p, --show-cygdrive-prefix show user and/or system cygdrive path prefix -V, --version output version information and exit
The mount program is used to map your drives and
shares onto Cygwin's simulated POSIX directory tree, much like as is done
by mount commands on typical UNIX systems. However, in contrast to mount
points given in
/etc/fstab, mount points created or
changed with mount are not persistent. They disappear
immediately after the last process of the current user exited. Please see
the section called “The Cygwin Mount Table” for more information on the concepts behind
the Cygwin POSIX file system and strategies for using mounts. To remove
mounts temporarily, use umount
If you just type mount with no parameters, it will display the current mount table for you.
Example 3.10. Displaying the current set of mount points
mountC:/cygwin/bin on /usr/bin type ntfs (binary) C:/cygwin/lib on /usr/lib type ntfs (binary) C:/cygwin on / type ntfs (binary) C: on /mnt/c type ntfs (binary,user,noumount) D: on /mnt/d type fat (binary,user,noumount)
In this example, c:/cygwin is the POSIX root and the D drive is
/mnt/d. Note that in this case, the root
mount is a system-wide mount point that is visible to all users running
Cygwin programs, whereas the
/mnt/d mount is only
visible to the current user.
The mount utility is also the mechanism for
adding new mounts to the mount table in memory. The following example
demonstrates how to mount the directory
/data for the duration of the current session.
Example 3.11. Adding mount points
ls /datals: /data: No such file or directory
mount //pollux/home/joe/data /datamount: warning - /data does not exist!
mount//pollux/home/joe/data on /data type smbfs (binary) C:/cygwin/bin on /usr/bin type ntfs (binary) C:/cygwin/lib on /usr/lib type ntfs (binary) C:/cygwin on / type ntfs (binary) C: on /c type ntfs (binary,user,noumount) D: on /d type fat (binary,user,noumount)
A given POSIX path may only exist once in the mount table. Attempts
to replace the mount will fail with a busy error. The
-f (force) option causes the old mount to be
silently replaced with the new one, provided the old mount point was a
user mount point. It's not valid to replace system-wide mount points.
-f option will silence warnings
about the non-existence of directories at the Win32 path
-o option is the method via which various
options about the mount point may be recorded. The following options
are available (note that most of the options are duplicates of other
acl - Use the filesystem's access control lists (ACLs) to implement real POSIX permissions (default). binary - Files default to binary mode (default). bind - Allows to remount part of the file hierarchy somewhere else. Different from other mount calls, the first argument specifies an absolute POSIX path, rather than a Win32 path. This POSIX path is remounted to the POSIX path specified as the second parameter. The conversion to a Win32 path is done within Cygwin immediately at the time of the call. Note that symlinks are ignored while performing this path conversion. cygexec - Treat all files below mount point as cygwin executables. dos - Always convert leading spaces and trailing dots and spaces to characters in the UNICODE private use area. This allows to use broken filesystems which only allow DOS filenames, even if they are not recognized as such by Cygwin. exec - Treat all files below mount point as executable. ihash - Always fake inode numbers rather than using the ones returned by the filesystem. This allows to use broken filesystems which don't return unambiguous inode numbers, even if they are not recognized as such by Cygwin. noacl - Ignore ACLs and fake POSIX permissions. nosuid - No suid files are allowed (currently unimplemented) notexec - Treat all files below mount point as not executable. override - Override immutable mount points. posix=0 - Switch off case sensitivity for paths under this mount point. posix=1 - Switch on case sensitivity for paths under this mount point (default). sparse - Switch on support for sparse files. This option only makes sense on NTFS and then only if you really need sparse files. This flag is always silently enabled on SSD drives. text - Files default to CRLF text mode line endings.
For a more complete description of the mount options and the
/etc/fstab file, see the section called “The Cygwin Mount Table”.
Note that all mount points added with mount are
user mount points. System mount points can only be specified in the
If you added mount points to
/etc/fstab.d/<username> file, you can
add these mount points to your current user session using the
-a/--all option, or by specifing the posix path
alone on the command line. As an example, consider you added a mount
point with the POSIX path
/my/mount. You can add
this mount point with either one of the following two commands to your
current user session.
The first command just adds the
mount point to your current session, the mount -a
adds all new mount points to your user session.
If you change a mount point to point to another native path, or if you changed the flags of a mount point, you have to umount the mount point first, before you can add it again. Please note that all such added mount points are added as user mount points, and that the rule that system mount points can't be removed or replaced in a running session still applies.
To bind a POSIX path to another POSIX path, use the
bind mount flag.
mount -o bind /var /usr/var
This command makes the file hirarchy under
/var additionally available under
-m option causes the
mount utility to output the current mount table in a
series of fstab entries. You can save this output as a backup when
experimenting with the mount table. Copy the output to
/etc/fstab to restore the old state. It also makes
moving your settings to a different machine much easier.
Whenever Cygwin cannot use any of the existing mounts to convert
from a particular Win32 path to a POSIX one, Cygwin will, instead,
convert to a POSIX path using a default mount point:
/cygdrive. For example, if Cygwin accesses
z:\foo and the z drive is not currently in the
mount table, then
z:\ will be accessible as
/cygdrive/z. The mount utility
can be used to change this default automount prefix through the use of
the "--change-cygdrive-prefix" option. In the following example, we
will set the automount prefix to
Note that the cygdrive prefix can be set both per-user and
system-wide, and that as with all mounts, a user-specific mount takes
precedence over the system-wide setting. The mount
utility creates system-wide mounts by default if you do not specify a
type. You can always see the user and system cygdrive prefixes with the
-p option. Using the
--change-cygdrive-prefix makes all new
automounted filesystems default to this set of options. For instance
(using the short form of the command line flags)
Example 3.13. Changing the default prefix with specific mount options
mount -c /mnt -o binary,noacl
Limitations: there is a hard-coded limit of 64 mount points. Also, although you can mount to pathnames that do not start with "/", there is no way to make use of such mount points.
Normally the POSIX mount point in Cygwin is an existing empty directory, as in standard UNIX. If this is the case, or if there is a place-holder for the mount point (such as a file, a symbolic link pointing anywhere, or a non-empty directory), you will get the expected behavior. Files present in a mount point directory before the mount become invisible to Cygwin programs.
It is sometimes desirable to mount to a non-existent directory, for
example to avoid cluttering the root directory with names such as
pointing to disks. Although mount will give you a
warning, most everything will work properly when you refer to the mount
point explicitly. Some strange effects can occur however. For example
if your current working directory is
/dir/mtpt is a mount point, then
mtpt will not show up in an ls
or echo * command and find . will