Linux Sync Buffer Progress Monitoring (e.g. For Copy To USB)
On my Linux system (Linux Mint), if I copy a huge file to an USB stick, then I always type “sync
” in a shell command line to make sure all buffers are flushed to the USB stick before I eject the USB stick.
This writing of the buffers can take quite a while (perhaps due to the huge amount of cache memory in the laptop).
To monitor progress, you can type the following in a shell:
watch "grep -e Dirty: -e Writeback: /proc/meminfo"
Code language: Bash (bash)
It will show something like this:
Dirty: 464 kB
Writeback: 0 kB
Code language: Bash (bash)
Where that bottom value is a large number of kilobytes when the copy is not done yet. You can see that counting down to zero, and when zero, the sync
will be done, and you can then unmount / eject the USB stick.