What is the rationale behind safely removing USB media from windows PCs?
This function is for removable media. That is, media that is connected via USB, FireWire, and as such, can be disconnected at any given moment.
Accessing the drive to write every piece of data to it as requested would put a lot more burden on the drive which would reduce performance and increase wear. To increase performance and reduce wear and tear, Windows can cache data in order to write a bunch of data at a time. It’s like delaying a trip to the other end of town until you have enough errands to do there to make the trip worthwhile.
The problem with caching is that if the drive happens to be unplugged between the time that the write request was made and the time that Windows “flushes” the cache to disk (actually performs the write), then that data would not get written. This leads to data loss and possibly even corruption.
By “ejecting” a removable volume, you tell Windows to flush the cache and write any data it has waiting. That way you ensure that it is safe to unplug the drive.
Quite often when I'm in a rush, I automatically pull out a USB pendrive or USB cable from an external hard drive from my desktop PC or laptop, without right-clicking on the safely remove icon in the system tray and unplugging via this route. So far nothing untoward has happened every time I have "been in a rush".
That’s mostly because Microsoft is not stupid (lets not argue here…) They know that people don’t like doing extra work. Therefore, when you plug a removable media into the system for the first time, when Windows installs drivers for it, part of the configuration it does is to set it for “quick removal”.
In the Device Manager, in the Policies tab of the Properties dialog for your drives, depending on the type of drive, you can choose to configure the drive for either quick-removal or better-performance or enable or disable write caching.
Enabling write-caching or selecting better-performance will cause Windows to queue write requests which increases performance and reduces wear, but also increases chances of data-loss and requires ejecting the volume before removing it. Disabling write-caching or selecting quick-removal causes Windows to write everything to the disk immediately which reduces performance and increases wear, but makes it okay to simply pull the drive out.
Because Windows defaults removable media to quick-removal, most people will rarely experience a problem from just unplugging it without ejecting first.
The screenshots below show the default drive policies for a variety of media. There are few interesting points to notice.
The internal hard-drive is set to use write-caching (figure 1). This makes sense because it is assumed that the drive is a permanent fixture, so it will never normally become unavailable in the short period between a write request and a cache flushing.
The USB flash-drive is set for quick-removal (figure 2). This too makes sense because it makes it convenient to remove it easily.
The USB memory-card is configured for quick-removal (figure 3). This is logical because it is essentially no different than a USB flash-drive (or any other USB drive). What’s interesting is that the internal memory-card reader is also set to quick-removal (figure 4). The reader itself is built into the laptop, and therefore always present, but the card can be removed, and so it defaults to quick-removal. (This is the same for floppy drives; there’s no caching because the disk in the drive could be removed.)
Even more interesting are the external USB hard-drive (figure 5), and iPod mini (figure 6) which has a little, spinning hard-drive in it. These are actual hard-drives, not flash-drives, but because they are removable, they still default to quick-removal. Again, this makes sense because they can be unplugged before the data is written to the disk.
Can I really lose information on USB media if this is not carried out ?
Is the vunerability [sic] of losing such information greatly increased, if the usb media is still flashing at the time of pulling it out of the computer (as opposed to non-flashing) ?
Yes. The problem is that even if a drive is set to quick-removal does not make it safe to unplug it right away. Just because Windows performs the writes immediately, does not mean that they occur immediately.
Most removable media such as flash-drives and memory-cards are much slower than hard-drives. Therefore, even though Windows initiates the write as soon as it is requested, it will usually take a few moments for the data to actually get written. Even if the write/copy/etc. dialog box that shows the write progress goes away, the drive may still be writing for a few more moments, and if it has its own drive-activity LED, you can see this. It is not safe to remove the media right away; watch the LED and wait for it completely stop flashing.
To be extra safe, you can use a program like Sync tell Windows to flush the cache. Essentially, it is exactly the same as using the safely-eject function, but can be a little more convenient if you make a shortcut on the desktop to run it with the specific drive-letter of your removable drive. It will save about 5-10 seconds which doesn’t sound like much, but in HCI, is a huge barrier. What’s even better is that it only flushes the cache, it does not actually eject the drive. Therefore, the drive is still mounted and available for use if you suddenly remember something you forgot to do with it. This makes it even more useful because you can even assign it a hotkey so that you can flush the cache and make it safe for unplugging with a keystroke.
Figure 1: Internal HDD policy
![Internal HDD policy](../../I/static/images/f924c6e19cb8b4c195b7964b4740ff3a4787bb4fe2c7cbc7a1b9701cc9d5335d.png)
Figure 2: USB flash-drive policy
![USB flash-drive policy](../../I/static/images/362b78affd6208b0f8e9e460171e7004f059fcb4e37af44868c895f4f3a9fea9.png)
Figure 3: Internal memory-card reader policy
![Internal memory-card reader policy](../../I/static/images/898d9e960087f0c37d0f5b71cc46324d0c52292048cece0b414ac5b1caefcd55.png)
Figure 4: USB memory-card reader policy
![USB memory-card reader policy](../../I/static/images/ec1ae5907ee42097b1a3ba66512613f09c30f7224e0d168c2a51ee41be761eb1.png)
Figure 5: External HDD policy
![External HDD policy](../../I/static/images/db52ad10be8bc53263aa0a6bad6af8d4b2ae67cfa49c09c3c9a7d010caab0c36.png)
Figure 6: iPod (mini) HDD
![iPod mini HDD policy](../../I/static/images/355b3edd917216a10edd85ab0bfc9de66f726fec770da0903f52e6a570247865.png)
5@woliveirajr, this is nothing similar to the duplicate? One is asking about ejecting and refers to CD ROMs and Kindles where as this is about understanding if information could be lost if removed unsafely. Happy to be wrong, but I can't see it. – Dave – 2013-09-18T14:51:00.843
7
possible duplicate of Will unplugging a USB key without safely removing it cause problems?. And see also Is There A Need To Safely Remove Device If “Quick Removal” Is Enabled?
– BlueRaja - Danny Pflughoeft – 2013-09-18T15:39:17.503@BlueRaja My question first of all asks for the rationale behind safely removing & secondly does not mention anything about enabling "Quick Removal". Is it not the same as the questions you have mentioned. – Simon – 2013-09-18T16:12:42.027
@woliveirajr I actually saw that question before posting this one. I don't think its the same. But at least people will now be able to access that question from here. – Simon – 2013-09-18T17:08:42.257
2
@Simon : I wanted, indeed, the http://superuser.com/questions/619076/what-does-safely-remove-hardware-do?lq=1 question, but it was marked as duplicate of the one that is linked in my comment. And the answer from "Augustus Francis" is about your question
– woliveirajr – 2013-09-18T17:09:35.4773ahem – wim – 2013-09-18T18:52:08.707
I've had at least two USB drives die on my because they were removed without safely doing so. I've also had one that I 'almost' lost but was still readable so I managed to repair/format it before it was too late. – Ian – 2013-09-19T09:51:50.850
@Ian To the two that died, had they finished reading/writing at the time of pulling them out ? – Simon – 2013-09-19T10:24:48.253
@Simon: One was several minutes after writing had finished (according to explorer), the other was in the region of 20 seconds. The latter I was in a hurry and windows refused to unmount the device despite everything appeared closed/not accessing the drive. – Ian – 2013-09-19T13:55:49.370
@Ian Even despite the one usb stick having finished "work" it was still corrupted because you did not "safely remove" from the system tray ? – Simon – 2013-09-19T14:53:03.720
In my experience some USB drives have outright failed to ever be recognised again after being unsafely removed. – deed02392 – 2013-09-19T15:08:13.213
@Simon: Yep, it basically wouldn't mount after that. The first few times windows reported "There was an error with the device", re-inserting it a few times left it completely undetected by the USB port. – Ian – 2013-09-19T15:08:58.480
@Ian Thats interesting, just shows how important "Safely Remove" really is. – Simon – 2013-09-19T15:17:37.597
@deed02392 Which obviously indicates the importance of "Safely Remove" from the system tray. – Simon – 2013-09-19T15:19:00.507
@Simon but that isn't remotely interesting - a reason why that happens would be, though. – deed02392 – 2013-09-19T15:34:54.000
@deed02392 That mechanism of events would indeed be good to know. – Simon – 2013-09-19T15:50:08.593
What we need is a flash drive that can physically hook itself into the USB port with little clamps and not let go (even if the user is trying to pull it out) until it's ready. – Thomas – 2013-09-20T00:40:39.343
1Try using left-click on the safely remove icon to safely remove a device instead of right-click. It is faster. – djhurio – 2013-09-20T07:05:13.843
@djhurio What happens if for argument sake you have more than one usb device plugged in ? Right clicking offers the option of which to remove. What about left clicking ? – Simon – 2013-09-20T09:06:30.253
@Simon RE: Left clicking: "When Advanced Users Outsmart Themselves"
– Chris Kent – 2013-09-20T09:36:33.653@ChrisKent Appreciate the link. However the issue is being in a such a rush as not even doing left click. It has also been the case that on many occasion I have also "Shut Down" my desktop PC whilst leaving USB media still in place. – Simon – 2013-09-20T11:17:21.597
@ChrisKent Whether this has additional impacts to what has been been mentioned already, I don't know ? – Simon – 2013-09-20T11:28:52.457
@Simon, left-click gives you a simple menu with all devices listed. You can distinguish them by the letter attached. The device is disconnected with two left-clicks in this case. – djhurio – 2013-09-20T13:18:51.093
back in the early 2000s, I've managed to render a pendrive's full filesystem and thus all data on it unuseable with only unplugging it without "safely removing". It was either with windows 2000 or some XP. I was shocked that a supposedly caching-related problem can have this effect. Since then I was always too skeptic to just unplug. The answer of MSalters is the closest thing I've ever read about the possible cause of this!
– n611x007 – 2013-09-23T12:54:07.817@naxa Appreciate your input, from first hand experience :) – Simon – 2013-09-23T12:56:24.773
Another interesting thing is the "can't eject some program is still using" situation. I'd expect that if no files are open, safely remove should always work, but it's not the case. One can list the open files with sysinternal's handle program, like
– n611x007 – 2013-09-23T13:42:24.633handle e:
where e: would be the pen's drive. But even if no file is open, sometimes you are still not allowed to "safely remove". I've always wanted to try and apply this post's interesting information here, just need the time.1@naxa You are right, that happens quite often to me, when I try to "safely remove". Sometimes I get annoyed because it keeps saying that, so I either just pull it out or "Shut Down" and pull it out when the computer is switched off. – Simon – 2013-09-23T13:51:04.057
1
@naxa Just came across this article of interest http://lifehacker.com/5863810/do-i-really-need-to-eject-usb-drives-before-removing-them
– Simon – 2013-12-31T10:18:59.297