Ubuntu – Unclear about USB drive ejection: “don’t unplug until finished”


I have a question about ejecting USB flash drives in Ubuntu Xenial 16.04.

When there is still some I/O going on upon clicking the eject button, I get the message:

Writing data to (…). Don't unplug until finished.

I get the message, but what is unclear to me: How will I get notified when the writing is finished? This message seems to stick around until it is dismissed. There is no additional message that notifies me I can unplug the drive.

And it is not possible to click "eject" again to check the status, because the drive has already disappeared in the explorer.

How is the user supposed to know when the drive can be ejected? Is there a terminal command I can use? More importantly, this seems like a shortcoming of the UI.

Best Answer

I have had this in the past and found a solution that works for me.

The command sync will ensure everything is written to all attached disks.

You should not need sudo sync for this unless the disk has some log files owned by root for example that also need writing.

If the sync command ends with no errors I've found it is safe to remove the drive.