Pull a USB flash drive out of your Mac without first clicking to eject it, and you’ll get a stern, shameful warning: “Disk Not Ejected Properly.”
But do you really need to eject a thumb drive the right way?
Probably not. Just wait for it to finish copying your data, give it a few seconds, then yank. To be on the cautious side, be more conservative with external hard drives, especially the old ones that actually spin.
That’s not the official procedure, nor the most conservative approach. And in a worst-case scenario, you risk corrupting a file or – even more unlikely – the entire storage device.
This is terrible advice for regular users, but I have to admit that I, too, don’t really use the safe eject features of operating systems, unless I want to eject right after completing a write operation.
I always use the safe eject feature if it’s available. If not, I run sync in a terminal.
Why risk it when you’ve got features explicitly designed to flush any pending writes to disk?
Back in the olden days of floppy drives, if you copied files to a floppy and then ejected the floppy without doing a sync, it just didn’t copy anything because of the way it buffered. Now I have a USB Floppy drive, if I copy with Nautilus/Files and then unplug it, it’s fine (it does the sync for us now).
So even then, progress!
leech,
IIRC DOS would flush outstanding IO (when smartdrv cache was enabled) before displaying the DOS prompt. This is because it was standard practice for users to simply cut power at the dos prompt to shut off the machine.
Back then it was pretty obvious when floppies were being accessed due to the noise and large activity indicator leds. Maybe as a data integrity feature, modern computers should play floppy disks sound effects as they are being accessed
On a serious note, IMHO the media indicators in windows icon tray are poorly designed, they could do a better job reporting disk IO activity.
You never know what you might have forgotten. Especially considering most thumbdrives are formatted in non-journaled formats, why risk data corruption by not hitting eject? Admittedly it’s a bit fiddly with the mouse hunting and pecking though, maybe there should be a universal keyboard shortcut.
Why would anyone rely on thumbdrives? Presumably the files you are using the thumbdrive to transport also exist elsewhere in a journaled file system. You wouldn’t be moving your only copy of anything onto a thumbdrive.
If I print a document on a piece of paper, and hand it to someone, I don’t expect the paper to go up in flames.
If I’m transferring data, or installing an OS (the most common uses for USB drives for me), I don’t want to wind up with corrupt data, or be unable to install an OS, because I was in too much of a hurry to let my computer flush it’s writes to the USB drive.
Sod’s law is that drive is for a presentation you are going to give in a foreign country and you’ll only notice it is corrupted when you get up to the podium.
Besides, I thought that if you leave a file open in Unix and yank the media, that file can never be closed and the OS won’t be able to shut down? Or is that an old wive’s tale?
The “can’t be shut down” thing may have applied to some really old UNIX systems, but it’s nowhere near true anymore.
“I’ve been pulling out thumb drives since the last five years and I haven’t had a problem,†says Frank Wang.
Yet.
Some of the files I transfer are pretty large (and who knows what Windows is doing in the background anyway).
And I may have more than one stick and may an HDD in the USB ports.
So I’ll stick to https://safelyremove.com/index.htm
Mac
Those who don’t think it is a big deal to just yank their USB drive out of the port after it appears to have finished writing data have obviously never had a thumb drive corrupted because of improperly ejecting it. What does it take to properly eject the drive, two seconds?
Seems so… I use pendrives since about 15 years, never used “remove safely” and I`ve never lost files because of that.
By the law of maximum inconvenience it will go wrong when you are trying to copy the most important file in your life.
Likely, some fluke in the usb port will at that moment cause your pc to explode, and corrupt all backup copies you may have had.
Had that happen to a fellow phd student (well, the pc did not explode). The event delayed his thesis for years.
Edited 2018-07-18 22:09 UTC
Or, you know, just eject it properly. Probably takes less time.
Well, not if the Windows’ Safely Remove applet states that it *cannot* safely remove the drive because something else is using it. Of course it doesn’t tell you which program it is. And then you look through all your Explorer windows whether I have anything open. Then, when inevitably nobody admits, find the fucking open handle with Process Explorer and *KILL* the guilty explorer.exe who wouldn’t admit (because its much nicer for Windows developers to create new 3D Paint, Virtual Reality APIs and Emojis than to fix anything in Explorer or the parts of Windows that people actually use). And THEN finally safely remove.
After a few times of that dance…unsafe removal it is!
And the fact that even clicking on “Safe removal” doesn’t pop the disk selection, you have to open a file explorer windows to try your luck with a right click on the disk, provided the “Eject” option is present.
Thanks Microsoft for making things difficult.
Good that someone is bringing stories from the Windows world in the discussion.
Nothing more frustrating than encountering a “Cannot Safely Remove” situation.
Assuming that all that what supposed to be written on the USB disc was written, the problem of yanking out the device is that it leaves it, and the system, in unsettled states.
Most often, the USB disc has to be mounted on another system to clean-up the entries/flags on it. And then, it has to be remounted on the original system to clean-up its internal entries/flags about that USB disc.
In worst cases, the data structures on the USB disc are so corrupted that the it cannot be recognized by Windows. And this usually happens when some files are needed NOW!
Or you could try unlocker.
http://www.emptyloop.com/unlocker/
It never ceases to amaze me what Microsoft doesn’t care to fix, when an old version of PCManFM from 2014 (not only four years old, but from a desktop somewhat infamous for playing catch-up on convenience features compared to KDE, GNOME, and Xfce) already had a helpful and informative “Volume is busy” dialog:
https://imgur.com/a/TIB40u5
Yeah, the advice I give people (and what I do myself most of the time) is to only worry about ejecting it manually if you actually wrote anything to it. If nothing got written (and it’s a filesystem that doesn’t store access times, which is almost always the case), you’re safe just removing it.
Of course, if dealing with Linux, always at least unmount it, otherwise you get dangling device references.
NTFS does store access times and just opening up the USB drive (and or a single file) in Windows Explorer will cause a pending write operation to update some last access times on the drive. If the drive is yanked while these write operations are in progress, well, there will be problems mounting the drive the next time it is used.
The problem I have with the article is that it refers to the Mac OS experience, which is valid for maybe 10-15% of all users. Most users are (still) under Windows…..
Except how many people do you know who actually use NTFS on a flash drive? It’s really not that common given that very few people reformat new flash drives on Windows, and no sane manufacturer ships anything other than FAT or exFAT on pre-formatted media. For USB connected hard drives and SSD’s maybe, but those are generally not connected and disconnected anywhere near as frequently.
Actually, I was a bit surprised to learned otherwise according to these articles:
( https://www.opentechguides.com/how-to/article/windows-10/129/enable-… )
and
( https://docs.microsoft.com/en-us/windows/desktop/FileIO/filesystem-f… )
, the NTFS last-accessed time stamp updating is disabled by default.
FAT32 and exFAT do update their last-access time stamps.
You need a more recent version of linux. Can’t remember the last time the OS didn’t cleanly remove an unmounted (or just removed) USB device.
No, it’s not a ‘recent’ version thing. It’s a manual versus automatic mounting thing. If you’re manually mounting things, you have to manually unmount them. If you’re automounting things (which you should not be doing if you care about security at all, malicious filesystems can crash your system when mounted with zero need for user intervention), it’s not an issue most of the time, except on rare occasion if you’re using certain storage stacks.
First, I don’t (as a rule) use untrusted media (ie, not my USB drive)– secondly, I don’t “automount”, I insert the device, let the OS recognize it, and then click the mount button.
Personally, I think I’d rather go through the layers and filters provided by udisks/polkit, which while it’s not very hard security, is still going to be better than mounting a device manually as uid 0– which offers absolutely no protection whatsoever.
Udisks provides no protection whatsoever either. The ‘mount’ system call is still being run with root privileges (but that’s not the security issue), and all of the work is still being done in the kernel itself (this is the security issue). All that udisks and policykit gives you is a way to initiate the mount call as a non-root user (which, arguably) actually reduces the security of the system).
Linux does not ever clean up dangling device handles. Your graphical environment, or udev, can be configured to do so but that does not in any way indicate that every up-to-date Linux installation is configured this way. Besides, Linux (or an other UNIX including MacOS) handle this stuff in pretty much the same way. Or do you not understand that “eject” just means “unmount”?
Well– No, it doesn’t. I’m assuming by “unmount” you mean “umount” instead of using “unmount” as a synonym for “eject”, because that would be silly.
To be more pedantic, I’m not using “eject”, even though the icon under Device Manager is the classic “eject” icon from our media devices– I’m doing a “safely remove”. “eject” typically implies physical removal.
If I “umount” a device, it’s still attached to the kernel, but not the filesystem. I can umount / mount repeatedly, use fdisk/parted, and it’s still visible under lsusb (assuming it’s USB).
“Safely remove” (at least under my system– kernel 4.14 / KDE 5.13) removes all attachments to the kernel– the device essentially no longer exists until you reinsert it– Capacity drops to 0, fdisk says “no medium found”, and it’s gone from lsusb.
So no, it isn’t the same as “umount”.
Actually, if you’re using udisks, the ‘eject’ option does three things in order:
1. It unmounts the volume, which syncs any VFS level buffers.
2. It syncs the device level buffers and flushes the device cache.
3. It then unbinds the driver from that particular device.
Those last two don’t happen on an unmount. The second item is really important if it’s a traditional hard drive in an external enclosure. The third is why the device completely disappears from the system.
Most other systems don’t differentiate ejecting removable media from unmounting it, at least not at the graphical level.
On a Mac, yes always. But on a PC, never and I don’t know anyone who does!
So do these people who can’t be bothered to safely eject also hop out of their cars before they’re in park (or the handbrake is on, for people with real transmissions…)?
Do they not bother checking to see if the gas pump is still pumping before they yank the nozzle out of the car?
Do they just assume their food is done, and remove it from the oven without checking (probably)?
It takes a few seconds– if it takes longer, then it’s absolutely critical that you properly remove the device. At best, you wind up with a corrupt file– at worst, you have a corrupt filesystem, and both will take far longer to detect and correct than ejecting the flippin’ device would have.
And also, do they just close the user applications and yank the power from their computers?
I generally always attempt to safely eject. It usually works in Linux and then I take my USB drive out and go. In Windows, it hardly ever works. Constantly telling me it can not safely eject it, even after I close every window that I have open. So I just yank it and go after a couple tries to safely eject.
At work, somebody needed to send me a file that was too big to send over email. He came in and handed me a USB drive.
I popped it into the computer and it was blank. So I gave it back.
He ran back to his office and came back later. I popped the USB stick in the computer and it was blank.
“I don’t understand,” he said. “I know I copied it!”
I asked him if he used the “Safe Remove” option and he said he didn’t. He just yanked it out as soon as the copy was done because he was in a hurry.
I told him to try the safe remove. He did and I finally got the file.
That was fun.
If you put a USB stick in and don’t write anything to it, then it’s “probably” alright to remove it without unmounting it (but definitely not 100% safe).
Linux (and presumably Windows?) has a disk buffer that – unless you force it with something like the “sync” command – can take up to 30 seconds to write buffered data to the device.
Hence, if you have written something to the stick, my advice is to wait 30 seconds before removing it without unmounting. However, if someone’s not going unmount it, they probably aren’t going to wait 30 seconds either! In that case, at least wait for a couple of seconds after the stick’s activity light has stopped flashing.
Me? I always unmount because I often write GB’s at a time to sticks and there’s no way I can be sure when it’ll finish (especially on my 64GB RAM desktop, which buffers the copy entirely).
This is one silly column. Playing russian roullette with your data? Of course it’s gonna be fine most of the time when you improperly eject your media… until it’s not. Gimme a break with the, ‘I do it all the time with my homework’ tripe. I’ve borked a number of files that were important this way. The idea that you can wait a sec, then remove your usb drive is ludicrous unless writing to the drive is the only thing your system is doing. At least one of y’all pointed out that you should run sync before jumping off the bridge. Sheesh, what kind of script-kiddie bulletin board are you running Holwerda?