ELI5: Why do you have to eject a usb drive before yanking it out?
Posted Aug 18, 2018, 4:32 AM UTC
Posted Aug 18, 2018, 4:32 AM UTC
I may have found yer answer, matey. Yer not alone in askin', and kind strangers have explained:
Ejecting makes sure there isn't anything being transferred between the computer and the USB drive and tries to make sure no new transfers will start
If you yank out the drive while something is being written to or read from it, the file, and possibly the drive, could become corrupted.
What happens wheb the drive is corrupted? And why does it get corrupted?
To be precise, the filesystem on the drive can get corrupted. That would mean that, for example, the entry in the file table for the file being written doesn't get completed, and as a result the whole directory entry might become invalid, so you'd lose access to everything in said directory. Obviously this is, uh, not ideal.
It gets corrupted because the computer writes some of the data, but then the drive is disconnected and the rest of it can't get there. The result is that only part of the data is written, and that kind of inconsistency can confuse a computer that tries to read the drive.
As has been said, it gets corrupted because you don't eject it. Or sometimes because of malfunctions or software bugs. For example, when you plug in your USB drive, your antivirus software is probably going to start scanning every file on it. So if you quickly unplug it, one or more files will be open. Ejecting the drive will close them.
If a file is open for reading only, then the chance of corruption is very low. The PC will no longer be able to read the file, but it'll generally cope with that error. If the file is open for writing, then that's where you have a problem. Imagine I'm updating my cheque (sorry, I'm British) book. I write a new cheque, and I also write in the little stub at the side. Then I tear off the cheque. Corruption could mean that there's a cheque missing but no stub, or there's a stub but no cheque, or an incomplete stub, or an incomplete cheque. Which means that, when I look through the stubs in order to find details of a cheque, I can't find it.
[removed]
[removed]
Ejecting the drive allows the computer to stop all data transfer and leave the drive in a 'safe' state.
Problems occur when a drive is in use and data is being transferred - if you pull the drive halfway through this process the data that is partially transferred can corrupt, which in certain cases can damage the whole drive.
Modern computers have partially solved this problem - when they are not actively being used they are stopped in a safe way so that they can be safely removed without ejecting them first, but you are still taking a slight gamble you don't have some program or other process in the background actively using the data, keeping it active and risking problems.
You don't "have" to, but it is good practice to make sure you don't corrupt anything. When the usb drive is plugged in, the computer often communicates with it through the port by sending an electrical signal back and forth. If you yank the usb drive out when a signal is being sent, you can damage parts of the drive or the port because that electricity will suddenly have nowhere to go and can even arc across a small air gap, causing burns, corrupting data clusters, shorting wires and other types of damage. Essentially it ensures the computer stops talking to it before you physically disconnect so that no damage is done when you yank it.
Edit: a word
For the same reason you can easily step out of a parked car, but would have a less fun time stepping out of a car going full speed down a highway
Good analogy