I read from here that the below command gives me the amount of data that needs to be written to the disk.
grep ^Dirty /proc/meminfo
It particularly says Ever ask yourself "How much data would be lost if I pressed the reset button?"
I wanted to test the above command and so I did the following.
dd if=/dev/urandom of=sample.txt bs=1G count=1
Now, in another shell I ran the above command.
grep ^Dirty /proc/meminfo
Dirty: 44 kB
grep ^Dirty /proc/meminfo
Dirty: 36 kB
However, if I do a file copy using cp
it reports,
grep Dirty /proc/meminfo
Dirty: 387680 kB
grep Dirty /proc/meminfo
Dirty: 609172 kB
I see from this page what Dirty does.
Dirty — The total amount of memory, in kilobytes, waiting to be written back to the disk.
Why Dirty is not reporting any size in case of dd
?
watch -n 1 grep Dirty /proc/meminfo
to see the updated result tilldd
finished. – cuonglm Sep 13 '14 at 18:31dd
is reading the amount of data you think you told it to read — but that isn't actually the case: thebs
parameter is only accurate in rare circumstances. Read Why does dd from /dev/random give different file sizes? and usecat
instead. – Gilles 'SO- stop being evil' Sep 14 '14 at 00:08