Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Windows 7, before unplugging an external hard disk or flash drive, you are ideally supposed to use the Safely Remove Hardware option to make sure there aren't any writes still pending.

Suppose it has been several minutes since the last write nominally completed. Is it safe to assume that this is long enough for everything to be written to the disk, so that you can just go ahead and unplug the device?

share|improve this question
add comment

4 Answers 4

up vote 42 down vote accepted

No, but it does not mean it is a death sentence if you do.

You can not guarantee that all the writes have been flushed out, but after several minutes of sitting it is likely that the data is flushed out. However, you may have some issues with some filesystem maintenance things that don't happen until you unmount if you are in "Performance mode" (see the next paragraph)

However there is another option (and it is likely already set for 99% of all removable media). If right click on the device and go to properties. Then from there go to the hardware tab and find your device.
enter image description here

Click Properties, then click on the Change Settings button on the new page. Go to the Policies tab.
enter image description here
If you device is set to "Quick Removal" you can remove your device without going though "Safely Remove Hardware" without worrying about data loss.

If you do not have a Policies tab you likely skipped the Change Settings step.

share|improve this answer
    
Well, I usually just take out my flash drive when I know it's not in use, but I will be sure to use this setting. Thanks! –  ekaj Apr 10 '12 at 2:52
1  
Most complete answer! Images say more than a thousand words –  kokbira Apr 10 '12 at 16:44
    
@ScottChamberlain Is plugging out a USB drive / hard drive without first "safely removing hardware" harmful to the physical disk? I'm not worried about data per se, but the lifetime of my physical USB drive / hard drive. Will it make the disk spoil faster / incur risks to events that may make the disk spoil faster? –  Pacerier Jul 5 '12 at 16:13
    
@Pacerier For solid state drives the only ware should be just the normal ware from reading and writing the drive. If you are using a spinning disk the only concern I would have is if you plugged it in then immediately unplugged it that could maybe do something to the servo motor. However neither of these two things are related to the "safely remove hardware". One thing that could "damage" the drive is if you are set to "performance" mode you could cause errors in the file allocation tables, but if you are set to "quick removal" you will be fine. –  Scott Chamberlain Jul 5 '12 at 16:31
    
@ScottChamberlain Hmm, but imagine I'm reading data (for example transfering data to another disk), and halfway I simply plug out the hard disk. Wouldn't this have a chance of damaging the physical disk in any way? –  Pacerier Jul 5 '12 at 16:51
show 4 more comments

It depends what style you set the drive to (optimize for performance or quick removal). Some filesystem updates are not written in performance mode until the drive is manually unmounted (i.e. clicking Safely Remove Hardware). So long as your device is not in performance mode (i.e. in quick removal mode, so write caching is disabled), you can just remove the device.

If it is, you have no choice but to click Safely Remove Hardware. This is the only way (aside from manually doing it through Computer Management) to unmount the filesystem safely. If you don't, nothing will probably happen - but it certainly could, and the filesystem certainly won't be as reliable as a clean mounted/unmounted one.

share|improve this answer
add comment

There could be any number of background programs that you don't know about that cause read/writes.

For example, lets say that you open a file in an editor... you are using the editor and click the file menu... for all you know, it could be that your item is in the recent files list and just by invoking the menu, you are causing some action on the file.

...So, whilst it is safer, it is not as safe as just using Safely Remove Hardware!

share|improve this answer
add comment

The correct time is 10 minutes.

10 minutes is enough to resolve any race condition.

Microsoft thinks so, which is why, once upon a time, they coded a 10 minute delay to wait for the last thread to leave a COM DLL before unloading it.

If you flip the flag in your library which causes it to start to return true from DllCanUnloadNow, you have 10 minutes to stop executing all code.

That's an eternity in machine cycles and hence, Q.E.D.

:)

share|improve this answer
2  
What do race conditions have to do with removing hardware? Phyiscal removal of hardware would seem to be the ultimate non-race condition. The COM DLL unload timeout is more likely a performance improvement hack in case the DLL gets used by the same or some other application. Sorry, your answer just doesn't make any sense in the context of the question. –  Michael Kjörling Apr 10 '12 at 6:26
    
-1. A COM DLL can be reloaded if it's needed after 11 minutes. Hardware can't plug itself back in. You can't compare them. –  MSalters Apr 10 '12 at 12:41
    
Some of you folks missed that this was humor. And yes, you can absolutely can compare these situations. Both are about relying on the passage of time to resolve a synchronization problem (ensuring that certain events do not happen before or after certain other events). And yes, that 10 minute timeout is about "resolving" a race condition. The COM DLL becomes eligible for unloading when the last reference is dropped, but the reference dropping is done by code executing in the DLL which needs to execute more code in order to return. –  Kaz Apr 10 '12 at 15:24
add comment

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.