Sometimes on Linux, when you copy alot of data to a slow USB flash drive, the operation is “done” in a second, but when you umount the drive (or run ‘sync’) it takes forever to write the cache to the actual device.
So, how to check the status (how much time is left, how much does it still need to write)?
The answer hides in
/proc/meminfo. Specifically the “
Dirty” and “
Writeback” lines in that virtual file. Very simplified, the “
Dirty” value tells you how much data is waiting in cache, and the “
Writeback” tells you how much data is being currently written to the device (chunk size).
You can check both values in semi-realtime with the following command:
watch "egrep -e '(Dirty:|Writeback:)' /proc/meminfo"