Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

up vote 13 down vote accepted

Try mountvol [drive:]path /d.

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

share|improve this answer
3  
Note to fellow googlers: it seems that this is not a good way force Windows to prepare your USB drives for safe removal; it works, but then if you reinsert the drive it won't get mounted anywhere at all. (If you have already done this, you can get it mounted again by first running mountvol with no arguments, finding the volumes listed with *** NO MOUNT POINTS ***, and then running a command like mountvol H: \\?\Volume{91a12b16-f469-11df-ad1c-00bdb269fc5}\ , except using your drive letter and volume path instead of mine.) –  SamB May 3 '11 at 20:15
    
I strongly believe this is not the answer. under windows xp mountvol only manages mountpoints but do not actually UNMOUNTS the filesystem. only the /p parameter unmounts the filesystem and it is not available on XP. see technet.microsoft.com/en-us/library/bb490934.aspx and technet.microsoft.com/en-us/library/cc772586.aspx –  Costin Gușă Oct 3 at 1:31

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.

share|improve this answer
    
chkdsk /f: is not really forcing a dismount as it says. it only clears open handles and denies access until it finishes, THEN it remounts the filesystem. a command trying to use a path on that fs will get an "access denied" message during chkdsk, but then regain access after the chkdsk completes. devcon on the other hand REALLY removes the drive and only a plug-and-play rescan command (devcon rescan or from device manager - scan for plug and play devices) will have the filesystem mounted again. –  Costin Gușă Sep 8 at 19:15

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.

share|improve this answer
C:\Windows\system32\fsutil.exe volume dismount f:
share|improve this answer
1  
Note this only works with NTFS –  Steven Penny Jan 1 '13 at 18:30
    
I think it also works with FAT volumes since they are not journalled anyway. Microsoft says it works with FAT and NTFS: microsoft.com/resources/documentation/windows/xp/all/proddocs/… –  Costin Gușă Oct 4 at 20:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.