20

Is it possible to mount/unmount a physical hard drive in Windows XP?

Ideally, I'd like to be able to do this from the command line so that I could have batch files to do it, ie: mount.cmd unmount.cmd

Also, if the drives can be unmounted, will they spin down?

SamB
  • 271
  • 2
  • 14
tbone
  • 436

5 Answers5

15

Try mountvol [drive:]path /d.

For, info type mountvol /? (just mountvol) in cmd.exe.

SamB
  • 271
  • 2
  • 14
9

There's a pretty good discussion courtesy of some crazy developer, a bit down and in brings you to:

Microsoft provides a utility called devcon for free download. It's a "Command Line Uility Alternative to Device Manager". It can actually do many things that I won't get into here, but removing a plug & play device is a simple operation once you know the unique name of the device you want to manipulate.

After you've downloaded devcon, run "devcon status *" in a command window. This will generate a list of all the devices on your system. Look for the line which describes your device. In my case for my external hard drive the (very cryptic) line looks like this:

SBP2\MAXTOR&ONETOUCH&LUN0\0010B9F700AFC279 That full line is a bit much but any substring that remains unique will do. I have another maxtor drive on my system but nothing else that has the phrase "sbp2\maxtor" so I'll use that. The command to safely remove my external drive then becomes:

devcon remove sbp2\maxtor* The "*" at the end is a wildcard and matches the rest of the string.

Kara Marfia
  • 7,882
6
C:\Windows\system32\fsutil.exe volume dismount f:
1

Assuming it is not your primary drive, doing a 'chkdsk /f ' will prompt you to force a dismount.

C:\WINDOWS>chkdsk /f e:
The type of the file system is NTFS.

Chkdsk cannot run because the volume is in use by another
process.  Chkdsk may run if this volume is dismounted first.
ALL OPENED HANDLES TO THIS VOLUME WOULD THEN BE INVALID.
Would you like to force a dismount on this volume? (Y/N) n

There may be more elegant ways of doing this, but this is quick and easy.

Peter
  • 5,513
1

Yes, there is a tool that can do that for you. It is far more powerful than the green windows "Safely Remove Hardware" feature.

The tool is called HotSwap!

Using this tool you can even unmount drives attached on SATA. And yes, it spins down the device.

Confirmed working on Windows 10 and Windows Server 2016.

slayernoah
  • 1,810
Bernhard
  • 117