How to remove a USB drive without worrying if its been unmounted?

This is Gilles' answer, saving it here so it doesn't get lost.

If you use the sync mount option on the removable drive, all writes are written to the disk immediately, so you won't lose data from not-yet-written files. It's a bad idea, but it does what you're asking, kind of.

Note that sync does not guarantee that you won't lose data. Unmounting a removable drive also ensures that no application has a file open. If you don't unmount before unplugging, you won't notice if you have unsaved data until it's too late. Unmounting while a file is open also increases the chance of corruption, both at the filesystem level (the OS may have queued some operations until the file is closed) and at the application level (e.g. if the application puts a lock file, it won't be removed).

Furthermore, sync is bad for the lifetime of the device. Without the sync option, the kernel reorders writes and writes them in batches. With the sync option, the kernel writes every sector in the order requested by the applications. On cheap flash media that doesn't reallocate sectors (meaning pretty much any older USB stick, I don't know if it's still true of recent ones), the repeated writes to the file allocation table on (V)FAT or to the journal on a typical modern filesystem can kill the stick pretty fast.

Therefore I do not recommend using the sync mount option.

On FAT filesystems, you can use the flush mount option. This is intermediate between async (the default) and sync: with the flush option, the kernel flushes all writes as soon as the drive becomes idle, but it does not preserve the order of writes (so e.g. all writes to the FAT are merged).


Patient: "Doctor, It hurts when I do this."
Doctor: "Well, don't do that."
maybe the Marx Brothers, but they probably stole it from other vaudevillians if so

Both answers are fine, but I do question the question. If you can't remember to unmount a thumbdrive properly before removing it, perhaps you should remember harder.

In general, the problem has no good solution. The original Macintosh (c. 1984) had a 90mm floppy drive with no proper eject button. You either unmounted the disk or it wouldn't come out. They did provide an override for when the software refused to eject the disk, but you needed a special tool (unbent paper-clip) to actuate it. The paper clip formed a Don Normanesque "forcing function" as it was hard to be unaware that you were jamming a paper clip into a 1mm hole.

Because of the mechanics of a USB connector, it is hard to devise a similar forcing function for thumbdrives. Thus the imprecation: don't remove without unmounting. Also, it is unwise to ride in an automobile without a safety belt and just about every forcing function ever attempted failed to achieve the desired end.