sync
is used to synchronize cached writes to persistent storage.
It is often useful to watch the progress of a sync operation while it’s working, here are a few methods depending on the situation:
- “Dirty” memory (memory waiting to be written back to disk)
sync & watch -n 1 grep -e Dirty: /proc/meminfo
- System-wide (memory waiting to be written back to disk AND memory which is actively being written back to disk)
sync & watch grep -e Dirty: -e Writeback: /proc/meminfo
- Device-specific (i.e. SD Card, USB, …, etc)
sync & watch -t -n1 'awk "{ print \$9 }" /sys/block/sdd/stat'