Based on the other answers I made this over-bloated one-liner that tracks summary progress as well as device-specific progress:
# Create the command
watchSync() {
watch -n1 'grep -E "(Dirty|Write)" /proc/meminfo; echo; ls /sys/block/ | while read device; do awk "{ print \"$device: \" \$9 }" "/sys/block/$device/stat"; done'
}
# Run the command
watchSync
The output looks like this:
Dirty: 848956 kB
Writeback: 125948 kB
WritebackTmp: 0 kB
dm-0: 0
dm-1: 0
loop0: 0
loop1: 0
loop2: 0
loop3: 0
loop4: 0
loop5: 0
loop6: 0
loop7: 0
nvme0n1: 0
sda: 0
sdb: 0
sdc: 124
The above tells me that 1) I have a few 100,000 kBytes that need writing, and 2) the device being written to is sdc
. Sync is complete when, in this case, sdc
and Writeback
hit zero (this will happen at the same time).