So Linux "mounts" a hard drive to perform some operation such as reading/writing. Does Windows "mount" in the same way?
Is it called something different in the context of Microsoft?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communitySo Linux "mounts" a hard drive to perform some operation such as reading/writing. Does Windows "mount" in the same way?
Is it called something different in the context of Microsoft?
If you know Windows internals, do fix my errors, please.
"Mounting" consists of two primary parts, which are the same in both systems but their separation is somewhat different:
On Linux, the same mount()
function does both jobs; a filesystem has to be mounted explicitly on a user-chosen path and remains opened as long as it is mounted on at least one path (possibly more). Once all paths to that filesystem are umount()
ed, it is closed.
Windows mounts volumes automatically when the volume appears – it immediately opens the filesystem and assigns a drive letter and/or any other configured names to it.
A disk can be temporarily "dismounted" using the FSCTL_LOCK_VOLUME
and/or FSCTL_DISMOUNT_VOLUME
ioctl functions – for example, while running a chkdsk
on it – but is automatically mounted again when the program unlocks it or exits. This behavior could be viewed as kind of opposite to Linux. Since dismounting a filesystem is temporary, it retains the assigned names even while dismounted. (The "Safely Remove" function dismounts the filesystem and disables the underlying device, to prevent Windows from seeing the filesystem and remounting it.)
A filesystem can have several names assigned to it:
Drive letters (A:
, C:
, [:
) – automatically assigned to new disks and lost on reboot, although Windows remembers assignments configured by the user. In this way, they are similar to Unix mountpoints.
(Drive letters can also be assigned to arbitrary devices, including network filesystems supported by Windows. You can see their targets at \GLOBAL??\
and \Sessions\<session>\DosDevices\<loginid>\
in WinObj.)
Note: Drive letters are normally system-wide, but they can also be assigned session-wide using subst
or DefineDosDevice()
, and yes, it accepts [:
. The session-wide assignments are never stored anywhere and vanish on reboot.
Folder mount points (C:\Disks\Music
) – a filesystem can be mounted on any arbitrary directory, like in Unix; however, they are actually stored on the target disk, in the form of reparse points (a more powerful form of symlinks) which refer to the mounted disk by its volume name.
(Different kinds of reparse points also exist; a few standard ones are mount points, symlinks, directory junctions.)
Volume GUID paths (\\?\Volume{710308c0-978e-11e1-95bc-806d6172696f}\
) (at least that's how it seems to be called) – special paths in the Win32 namespace \\?\
, containing an UUID that Windows assigns to that particular volume on this particular Windows system. They cannot be changed. They are listed by mountvol
, or under \GLOBAL??\
in WinObj. Unlike drive letters, these are the same for all users.
Device interface paths \\?\STORAGE#Volume#<something>Signature<hex>Offset<hex>Length<hex>#<uuid>\
Unlike a volume GUID path, each volume has exactly one device interface path.
\Device\HarddiskVolume23
- unlike all the previous ones, which are just symbolic links, this directly names the volume. You know this because it's in the \Device
namespace, not the \\?
namespace. That also means you can't use it with functions such as CreateFile
. diskmgmt.msc
, mountvol
and diskpart
can manage both drive letters and mount points.
Even when a volume doesn't have any drive letters and isn't "mounted" on any folder, it remains open and its contents can still be accessed through its volume name; e.g.
\\?\Volume{710308c0-978e-11e1-95bc-806d6172696f}\Windows\Explorer.exe
DefineDosDevice()
accepts practically anything, although you won't have much luck convincing most applications to accept it. Try subst [: C:\Users
, then dir [:
– user1686
May 14 '12 at 16:26
[:
– iglvzx
May 15 '12 at 7:06
mountvol.exe
is the Windows equivalent.
mountvol
prints on my machine. So it shouldn't be anything too hard to reproduce. If I put the plain text in here, it became harder to read because of the box with scrollbars :( If you want to edit the answer to improve it, go ahead :)
– Der Hochstapler
Sep 20 '12 at 8:47
Yes, but in general, it is handled automatically (say, with a USB drive).
The Disk Management utility (part of Computer Mgmt), allows you to manipulate volumes and mount points. Explorer does the same for network shares. There are command-line versions (diskpart.exe in WIn 7) as well depending on the version of Windows you run.
Safely Remove Hardware
menu. To re-mount those devices, unplug the connection cable (USB/FireWire/eSATA) and plug it back in, or disable the USB/FireWire/etc. device from Device Manager and re-enable it, and Windows will automatically re-mount it.
– Lèse majesté
May 14 '12 at 16:17
The shortest, most obvious answer to fill in your _ _ _ _ _ _ is "mount". Linux mounts (and unmounts) file systems and so does Windows.
They each automate this process to varying degree depending a slew of mixed factors I'm not capable of listing, but I think caching strategies, user style/preference, and patents are significant influences on the automation of this process.