Failing to safely eject hardware from a computer is one of the most common mistakes I see computer users make. Most people do not realize that unplugging a flash drive or an external hard drive without ejecting it first can damage the files stored on it, or even the hardware itself in some cases.
If a storage device is unplugged from a computer while files are being written to it or read from it, there will most likely be some data corruption. If you were saving a file to the storage device, when it was unplugged, not all of the data had time to be copied there, and so the next time you try to open that file from that device, the file will most likely fail to open, or the data will be garbled or incomprehensible depending on what type of data it is.
Unplugging a flash drive while files are not being written to it will typically not result in problems, however it can be difficult to tell when files are no longer being written or accessed. Some programs will try to access files on the drive constantly, so unplugging the drive at any time without safely ejecting it first can cause problems. Additionally, unplugging external hard drives without ejecting them can damage the drive. If the read/write head on the drive suddenly loses power, it can strike the data platters and kill data sectors, making the data on them unreadable and the hard drive more likely to fail completely in the future.
To safely eject a storage device on a Mac, you can either click on the eject icon next to the device’s listing in the Finder sidebar, or drag and drop the device’s icon into the trash, which should turn into an eject icon when a storage device is dragged over it. Keep in mind that only storage devices need to be safely ejected, not keyboards, mice, or other peripheral devices that do not have internal storage.