Tag Archives: Windows

Command Line Mounting and Unmounting drives/volumes – Windows

Today we came across an issue while working on a virtual server. We had created a virtual hard drive, attached it to the virtual Windows 2008 Server machine, added some files to it and wanted to unmount the virtual drive and then attach it to another virtual machine.

The virtual machine manager (XenCenter in this case) wouldn’t allow us to disconnect the drive, while the virtual guest OS was still using it.

A quick Google and we finally found this command:

mountvol

Creates, deletes, or lists a volume mount point.

That’s exactly what we needed. Heres how to use it:

Creates, deletes, or lists a volume mount point.

MOUNTVOL [drive:]path VolumeName
MOUNTVOL [drive:]path /D
MOUNTVOL [drive:]path /L
MOUNTVOL [drive:]path /P
MOUNTVOL /R
MOUNTVOL /N
MOUNTVOL /E

path        Specifies the existing NTFS directory where the mount
point will reside.
VolumeName  Specifies the volume name that is the target of the mount
point.
/D          Removes the volume mount point from the specified directory.
/L          Lists the mounted volume name for the specified directory.
/P          Removes the volume mount point from the specified directory,
dismounts the volume, and makes the volume not mountable.
You can make the volume mountable again by creating a volume
mount point.
/R          Removes volume mount point directories and registry settings
for volumes that are no longer in the system.
/N          Disables automatic mounting of new volumes.
/E          Re-enables automatic mounting of new volumes.

To unmount the drive that was in use we just used:

mountvol E:\ /D

The E:\ drive was then released from Windows and this allowed us to use and mount the disk else where.