mount

mounts file systems 

Command


SYNOPSIS

mount [-o option] [-v|-q] object path


DESCRIPTION

The mount utility grafts a file system object onto the file tree at the point indicated by path. mount can graft objects in three different ways. Not all operating systems support all three ways.

Remote Drive Mounts or Network Mounts: 

This method maps a drive letter to a network share point.

When you specify + as the value of path, mount assigns the next drive letter available alphabetically.

Mounts created using this method optionally persist over a logon of the current user.

You may specify path in the form of a UNC name (that is, //hostname/sharepoint) or in the form hostname:/sharepoint).

Here are a couple of examples:

mount //tkbuild/share s:/
mount tkbuild:/share +
Substitution Mounts: 

This method substitutes a drive letter for a path name.

When you specify + as the value of path, mount assigns the next drive letter available alphabetically.

Mounts created using this method do not persist over a reboot.

This method is available for 10/2016/2019/11/2022/2025.

For example,

mount c:/winnt w:/
File System Mounts: 

This method mounts a Windows volume into a subdirectory of the file system or a drive. For example:

mount d:/  c:/d_drive

or

mount //?/Volume{2a537b5c-924e-11d7-a242-806e6f6e6963}/ c:/mnt/flash_card

Note:

You should be careful with this method because it is possible to create a recursive mount such that programs that walk the file tree loop forever.

For example, the command

mount c:/ c:/dir

makes the following infinite path valid:

c:/dir/dir/dir/dir/dir/.../dir

Similarly, the commands

mount d:/ c:/d_dir
mount c:/ d:/c_dir

make the following infinite path valid:

c:/d_dir/c_dir/d_dir/c_dir/.../c_dir

Mounts created using this method persist until manually removed.

This method is only available on 2016/2019/2022/2025.

The mount utility determines the type of mount to use based on how the object and path arguments are specified.

object path Mount type used
//?/Volume{...} anything If the object is a valid Windows object, this is treated as a file system mount; otherwise, this is treated as a UNC name.
UNC name anything network mount
machine_name:/pathname anything network mount
pathname drive root substitution mount
other anything file system mount

When you specify no arguments, mount displays all current network shares, volume mounts, and substs. For example:

$ mount

C:/mnt/old_x/ on //?/Volume{2a537b5c-924e-11d7-a242-806e6f6e6963}/      read/write
C:/mnt/old_i/ on //?/Volume{2a537b5d-924e-11d7-a242-806e6f6e6963}/      read/write
C:/mnt/20G/ on //?/Volume{e1587f8c-e325-11d7-920f-806e6f6e6963}/        read/write
C:/mnt/syjet/ on //?/Volume{7d665155-9920-11d7-a24b-00018036a2fe}/      read/write
A:/        on //?/Volume{cc91f042-920f-11d7-9b28-806e6f6e6963}/ read/write
C:/        on //?/Volume{022cd01d-920f-11d7-ad0b-806e6f6e6963}/ read/write
D:/        on //?/Volume{cc91f043-920f-11d7-9b28-806e6f6e6963}/ read/write
E:/        on //?/Volume{cc91f044-920f-11d7-9b28-806e6f6e6963}/ read/write
M:/        on //MYHOST-AFS/auto1        read/write
N:/        on //myofficemachine/c$    read/write
X:/        on //mybuildserver/build3   read/write
Y:/        on //mysambabox/joe read/write
Z:/        on //myfileserver/users/joe     read/write

Options

-o option 

specifies optional information for mount to use. The following values for option can be specified.

u[ser]=username 

specifies the user name to be used when mounting remote drives (if necessary). If a user name is needed and none is specified using this option, mount uses the current user name.

p[assword]=password 

specifies the password to be used when mounting remote drives. If a password is required and you do not specify one with this option, you are prompted to provide it. Normally, no password is required if the machine is already connected.

per[sistent]=[yes|no

specifies whether or not the mounts to remote drives are persistent across reboots. If this option is not specified, the default is yes (that is, remote drive mounts are persistent).

loop[=device

uses Linux syntax to specify that a disk image specified by path be attached to a loop device and then that device mounted. Windows has no loop devices, but there is a way to attach virtual disks and ISO images to create volumes, and then to mount the volumes. device is ignored and unnecessary. mount calls out to vhdutil to attach the specified file and then determines first partition/volume to be mounted on the specified directory or drive letter.

Such mounts do not persist across reboots.

You may use vhdutil to attach a VHD or ISO and then mount a volume/partition by volume id, or do it all in an easier single command. Here are some examples.

Attach an ISO image and mount it on a directory

$ mkdir -p c:/mnt/iso/FreeBSD
$ mount -o loop c:/iso/FreeBSD-11.1-source.iso c:/mnt/iso/FreeBSD
$ mount -v
...
c:/mnt/iso/FreeBSD on //?/Volume{32001003-723a-11ea-a4f9-0023ae82baa1}/  file C:/iso/FreeBSD-11.1-source.iso type   UDF label FREEBSD 11.1 read
...

Create a new vhdx file of size 10M, create 2 partitions, format the first one FAT of size 1M and the second one NTFS of size 9M and mount the NTFS partition. You will need to have SE_MANAGE_VOLUME_PRIVILEGE asserted, which may require elevation.

$ priv -e -a SeManageVolumePrivilege
$ vhdutil -c c:/vhds/my.vhdx -x -s 10485760
Virtual Disk (VHDX Virtual Disk): c:/vhds/my.vhdx
        Virtual Size: 10485760
        Physical Size: 4194304
        Block Size: 33554432
        Sector Size: 512
        Device GUID: {826CE5E4-BC27-4EC3-B4BE-5305439EF8F8}
$ vhdutil -a c:/vhds/my.vhdx
VHDX Virtual Disk:      c:/vhds/my.vhdx  //./PHYSICALDRIVE1
$ # Caution here as we do no read the vhdutil output in this example and just select disk 1
$ script=`tempfile`
$ cat <<EOS >"${script}"
select disk=1
create partition primary size=1
create partition primary
exit
EOS
$ diskpart -s "${script}"
$ rm -f "${script}"
$ vhdutil -l -j
[{
                "type": "VHDX Virtual Disk",
                "file": "C:/tmp/my.vhdx",
                "device":       "//./PHYSICALDRIVE1",
                "partitions":   ["//?/Volume{9d68c9c4-0000-0000-0000-010000000000}/", "//?/Volume{9d68c9c4-0000-0000-0000-110000000000}/"]
        }]
$ # Might be fun to have a way to parse the JSON output of vhdutil so we could automate the mounts
$ mkdir -p c:/mnt/vhds/1
$ mkdir -p c:/mnt/vhds/2
$ mount //?/Volume{9d68c9c4-0000-0000-0000-010000000000}/ c:/mnt/vhds/1
$ mount //?/Volume{9d68c9c4-0000-0000-0000-110000000000}/ c:/mnt/vhds/2
$ format /FS:FAT c:\\mnt\\vhds\\1 /y
The type of the file system is RAW.
The new file system is FAT.
Formatting 1024.0 KB
Initializing the File Allocation Table (FAT)...
Format complete.
    1000.0 KB total disk space.
    1000.0 KB are available.

          512 bytes in each allocation unit.
        2,000 allocation units available on disk.

           12 bits in each FAT entry.

Volume Serial Number is A41D-564E
$ format /FS:NTFS c:\\mnt\\vhds\\2 /y
The type of the file system is RAW.
The new file system is NTFS.
Formatting 7.9 MB
Creating file system structures.
Format complete.
       7.9 MB total disk space.
       5.8 MB are available.

$ umount c:/mnt/vhds/1
$ mount -v
...
Unmounted      on //?/Volume{9d68c9c4-0000-0000-0000-010000000000}/  file       C:/vhds/my.vhdx type   FAT label            read/write
...
C:/mnt/vhds/2/ on //?/Volume{9d68c9c4-0000-0000-0000-110000000000}/  file       C:/vhds/my.vhdx type  NTFS label            read/write
...

-q 

does not prompt you for a password, If a password is required and not specified on the command line with the -o p=password option, the mount will fail.

-v 

displays information about the actions performed by mount (verbose mode). Normally, mount produces no output unless an error occurs. When used with no other arguments, mount lists all Windows volumes even if they are not mounted anywhere.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

>0 

An error occurred.


PORTABILITY

Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.

This version of the mount utility does not support the concept of a mnttab, it uses Windows-specific ways of determining if something is a mount point or not. See the DESCRIPTION section for details on persistence.


AVAILABILITY

PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
umount, vhdutil


PTC MKS Toolkit 10.5 Documentation Build 40.