MOUNTVOL - CMD


Overview

The Windows CMD command MOUNTVOL is used for displaying, creating, or removing volume mount points in Windows. It allows users to manage how volume names are assigned and linked to specific storage volumes on the system. This command is particularly useful in setups where managing drive letters is cumbersome or when direct paths to volumes are necessary, such as in server environments or systems with multiple storage devices.

Syntax

The basic syntax for MOUNTVOL is as follows:

MOUNTVOL [drive:]path VolumeName
MOUNTVOL [drive:]path /D
MOUNTVOL [drive:]path /L
MOUNTVOL [drive:]path /P
  • [drive:]path: Specifies the existing NTFS directory where the mount point will reside.
  • VolumeName: Specifies the volume name that is to be associated with a mount point.

Options/Flags

  • /D: Removes the volume mount point from the specified directory.
  • /L: Lists the current volume name that is mounted to the specified path.
  • /P: Removes the volume mount point from the specified directory, dismounts the volume, and makes the volume not mountable. You can use this option to ensure that the data on the volume cannot be accessed until the volume is remounted.

Examples

  1. Displaying Available Volumes:
    List all available volumes and their properties:

    MOUNTVOL
    
  2. Creating a Mount Point:
    Create a mount point for a volume on an empty NTFS folder C:\mount\drive1:

    MOUNTVOL C:\mount\drive1 \\?\Volume{12345678-abcd-1234-abcd-123456789abc}\
    
  3. Removing a Mount Point:
    Remove a mount point from the directory C:\mount\drive1:

    MOUNTVOL C:\mount\drive1 /D
    
  4. Listing the Mount Point:
    Display the volume name for a specific mount point:

    MOUNTVOL C:\mount\drive1 /L
    

Common Issues

  • Permission Errors: If you encounter permission issues, ensure your command prompt is running with administrative privileges.
  • Invalid Path: Ensure that the directory where you are trying to set up or remove a mount point exists and is empty.

Integration

MOUNTVOL can be integrated with other CMD commands or scripts for managing volumes and mount points automatically. For example:

FOR /F "tokens=*" %%V in ('MOUNTVOL ^| FIND "Volume{') DO (
    MOUNTVOL C:\mount\%%V \\?\%%V\
)

This script finds all volumes and creates a mount point for each under C:\mount.

  • DISKPART: Useful for managing partitions and volumes at a deeper level.
  • CHKDSK: Helps in checking the file system and status of the system volumes.

For further reading and more detailed information, consult the Microsoft official documentation on Mountvol.