Whenever you plug in a USB storage device, Windows will usually give you a prompt about whether or not it is safe to eject it. So what’s the deal with this anyway? You’d think with how common of an issue it is that there would be more information on it from the Windows interface, right?
If you’re wondering what this even is, check out the system tray the next time you plug in a thumb drive or other USB storage device. A little USB icon with a green checkmark will pop up. This is the same icon that you can click to safely eject a device before you physically remove it from the computer.
What Windows Says About It
If you yank a USB drive out without safely ejecting it first Windows doesn’t pop up a warning message like OS X. Instead, it just unplugs — and that’s that. Or is it? If you open up the Device Manager and view the properties of the USB Disk Drive you have plugged in you can see why Windows doesn’t seem to care if you unplug early.
Windows has two policies. The default is to automatically disable write caching for devices that it sees as temporary or removable. Under this policy, Windows states that you can always disconnect the device safely without using the Eject option. That isn’t accurate, but we’ll get to that in a minute. The second profile is called “Better performance” and it keeps write caching enabled for the connected device. Interestingly, on a Linux or Mac computer this second policy would be the default as they always leave write caching turned on. To understand what all of this means you need to first understand what write caching is.
What is Write Caching?
Write caching is the default method used for storing data on hard disks, and if enabled it can be used for removable drives as shown in the screenshot above. When you copy files over to a disk, Windows doesn’t transfer the data directly to it. Instead, some of the data is temporarily saved to the computers highly-volatile memory cache, or buffer. This is done because the data transfer to the USB is slower, even with modern USB technology. The downside is that the buffer where the data is being stored is erased when power is removed, or when the destination is removed. Such can happen when you unplug the USB device before the cache is completely written to it. Using the Eject command forces the OS to write all remaining data to the USB stick and sever the connection on a software level, so no data is lost.
Data Can Always Be Lost, Even with Write Caching Disabled
Generally, the default profile in Windows works for most people. But even though Windows says that data is safe with write caching disabled, it isn’t always. If you pull the USB drive out during a data transfer, data loss and corruption can occur. If you’re running a portable app from the USB drive, or using an application on the computer that saves data to the USB drive you can also lose data. There have even been cases where users have had corrupted data just by using a USB stick for ReadyBoost and pulling it out without ejecting.
Write Caching Offers Better Performance with Slightly More Risk
Write caching can offer better performance for your system because it prevents transfers to storage devices from hogging all of the I/O bandwidth. The downside is that data is more likely to be caught in the cache and corrupted or lost if the device is unplugged without safely ejecting it first. The Eject function saves data from being deleted by using a cache flushing system embedded in Windows. Cache Flushing forces all of the data in the cache to immediately write to the device and then clear itself out. Once Windows says that the device is safe to remove, that is how you know the cache has finished flushing.
With all of that said, it’s best to always safely Eject hardware before you physically unplug it from the computer. Also remember that while Windows may have a “feature” that disables write caching, Linux and Mac keep it enabled by default, so be extra careful when using a thumb drive with those operating systems.