Home » Linux » Linux: Outputting DD results to a text file

Linux: Outputting DD results to a text file

Posted by: admin January 30, 2018 Leave a comment

Questions:

I’m writing a script that tests the read and write speeds of my HDD. I’ve been able to output the read speeds using the hdparm command. I’m using this line to test the write speeds:
dd if=/dev/zero of=/tmp/test.data bs=1k count=128k

This outputs to the window:

131072+0 records in
131072+0 records out
134217728 bytes (134 MB) copied, 1.18678 s, 113 MB/s

I tried using >> and > to output the results to the text file and these didn’t work. Does anyone know how I can output my results to a text file?

Answers:

They’re output to stderr, so try using 2> instead of >

dd if=/dev/zero of=/tmp/test.data bs=1k count=128k 2> output.txt

Questions:
Answers:

dd’s good for sequential writes, but also check into iozone and bonnie. Seeks within a track tend to be far faster than seeks from one track to another, so random I/O can be very different from sequential.