A copy to a USB stick finishes in seconds, yet the stick keeps blinking. Linux accepted the data into memory and writes it out in the background. Two lines in /proc/meminfo show how much is still on its way.
watch -n 1 "grep -E '^(Dirty|Writeback):' /proc/meminfo"
Dirty is data in memory that has changed and still waits to be written. Writeback is data that is being written right now. After a big copy you see Dirty jump up and then drain away. When both are back to a few hundred kilobytes, the system has caught up.
To wait for one disk in particular, use sync on it:
sync -f /media/usb/backup.tar
sync -f flushes the filesystem that file lives on, and returns when the data is written. Unmounting does that too, which is why umount can take a while after a fast copy. I’d always unmount before unplugging, and watching these numbers explains the wait.
How much dirty data may pile up is set by vm.dirty_background_ratio and vm.dirty_ratio. The first decides when the kernel starts writing in the background, the second when a program that writes has to wait and help. On a machine with lots of RAM and a slow USB disk, those percentages allow gigabytes of unwritten data, so a copy looks fast and the unmount takes ages. Lowering them makes copies look slower but more honest. Change them carefully and test, since they affect every disk at once.
Further reading: proc_meminfo(5) manual page, Documentation for /proc/sys/vm/