Platform SDK: Files and I/O

Volume Mount Points and Mounting Volumes

A volume mount point is a directory on a volume that an application can use to "mount" a different volume, that is, to set it up for use at the location a user specifies. In other words, you can use a volume mount point as a gateway to the volume. When a volume is mounted at a volume mount point, users and applications can refer to the mounted volume by the path of the volume mount point or a drive letter. For example, with a volume mount point set the user might refer to drive D as "C:\mnt\Ddrive" as well as "D:".

Using volume mount points, you can unify into one logical file system disparate file systems such as Windows 2000 NTFS, a 16-bit FAT file system, an ISO-9660 file system on a CD-ROM drive, and so on. Neither users nor applications need information about the volume on which a specific file resides. All the information they need to locate a specified file is a complete path. Volumes can be rearranged, substituted, or subdivided into many volumes without users or applications needing to change settings.

Your application can designate any directory on a volume other than the root as a volume mount point. Instead of making the root directory a volume mount point, your application should create a subdirectory and make that a volume mount point.

When a volume is mounted, volume mount points refer to the drive, not the medium in the drive. Thus, you need not unmount and mount volumes to change removable media.

You can set multiple volume mount points to refer to the same physical drive. For example, you might have a volume mount point for each of several compact discs, all of which share one CD-ROM drive. Each point refers to the same physical CD-ROM drive, and you can access any disc in the drive from any of the volume mount points. The advantage of setting multiple volume mount points is that the different paths make clear the difference between different CDs' applications, for example between a word processor and a game.

To give a brief example of the use of volume mount points, suppose you have a computer with four volumes on it. You have two partitions on a single hard drive, a CD-ROM drive, and a removable media drive. In a conventional system, you might refer to these volumes as C, D, E, and F, respectively.

To use volume mount points, you might build a directory on C: called \mnt:

mkdir c:\mnt

Below that, you might build directories Ddrive, CDROM, and removeable:

mkdir c:\mnt\Ddrive
mkdir c:\mnt\CDROM
mkdir c:\mnt\removeable

Then you might mount each volume at its volume mount point, using a hypothetical command-line utility called Mountvolume:

mountvolume c:\mnt\Ddrive d:
mountvolume c:\mnt\CDROM e:
mountvolume c:\mnt\removeable f:

At this point, you can refer to the root directory of the removeable drive as either F:\ or as C:\mnt\removeable. You can also refer to files on the mounted volume with a concatenated path. Thus, you can refer to the file "D:\Program Files\Windows NT\Accessories\Wordpad.exe" as "C:\Mnt\Ddrive\Program Files\Windows NT\Accessories\Wordpad.exe".

After the volume mount points have been established, they are maintained through computer restarts automatically.

If a volume fails, paths that cross the failed drive break. Thus, it is best to mount all volumes to the boot drive (usually drive C). It is a useful mnemonic for system administrators to use one directory as the volume mount point for all volumes on the system, but nothing in the volume mount point design requires that you use only one directory.

A volume mount point is a directory where a volume can be mounted but not necessarily where a volume currently is mounted.

NTFS volume mount points are implemented by using reparse points and are subject to their restrictions. For more information, see Reparse Points. Volume mount points are supported by Windows 2000 NTFS and higher. It is not necessary to manipulate reparse points in order to use volume mount points; the volume mount point functions handle all the reparse point details for you.

Because volume mount points are directories, you can rename, remove, move, and otherwise manipulate them, just as you can with directories.

Volume mount points are available only in Windows 2000. Only NTFS volumes can hold a volume mount point, although any local drive can be mounted on one.