Yes, you have to wait, but
sync(1) (not
sync(2) because it is not the command line tool, but a C function and they not necessarily work the same way, even if
sync(1) may use
sync(2)) will not exit until the cache has been flushed.
But yes, using unmount is the best way to do.
(And I'm really sorry for all non Linux speaking person here such a message could be really cryptic

)
(and the Linux man page for
sync(2) have this information:
Quote:
BUGS
According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before the actual writing is
done. However, since version 1.3.20 Linux does actually wait. (This still does not guarantee data integrity: modern disks have large
caches.)
|
And flash device does not have such cache.