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
?
Best Answer
Try using this command instead:
dd
will only write assign the data to be written to disk when it got all of thebs
size in its memory.Here is the output of
ps
for add
of 128mb just before the output was written to disk:You can see the process is using about 130mb of ram (RSS Column)