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?

  • If I'm reading correctly, you answered your title in your question.
    – Braiam
    Sep 13, 2014 at 18:20
  • @Braiam, Thanks. changed the title to be more meaningful.
    – Ramesh
    Sep 13, 2014 at 18:26
  • @Ramesh: You should use watch -n 1 grep Dirty /proc/meminfo to see the updated result till dd finished.
    – cuonglm
    Sep 13, 2014 at 18:31
  • You may be surprised because you believe that dd is reading the amount of data you think you told it to read — but that isn't actually the case: the bs parameter is only accurate in rare circumstances. Read Why does dd from /dev/random give different file sizes? and use cat instead. Sep 14, 2014 at 0:08

1 Answer 1


Try using this command instead:

dd if=/dev/urandom of=sample.txt bs=1M count=1024

dd will only write assign the data to be written to disk when it got all of the bs size in its memory.

Here is the output of ps for a dd of 128mb just before the output was written to disk:

root      4465  100 12.8 236260 129784 pts/1   R+   17:15   0:13 dd if=/dev/urandom of=sample.txt bs=128M count=1

You can see the process is using about 130mb of ram (RSS Column)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.