Greg Wooledge wrote: > <https://linux.die.net/man/8/sync> which says: > > On Linux, sync is only guaranteed to schedule the dirty blocks for > writing; it can actually take a short time before all the blocks are > finally written. The reboot(8) and halt(8) commands take this into > account by sleeping for a few seconds after calling sync(2).
There are situations in which it can take much longer than a few seconds. They require a large amount of data to write and a slow storage mechanism. Specific example: recursive copying of music files to my USB-2 attached music player, which has an actual write speed of about 20 MB per second. The cp -r or rsync of a few gigabytes can return well before the data is actually written. -dsr-