Does dd verify data as it is writing?

2

2

I'm zeroing a drive with

dd if=/dev/zero of=/dev/sdd

on a USB 3.0 port and it appears that the disk is writing half of the time and reading half of the time.

17564 be/4 root       10.59 M/s   10.59 M/s  0.00 % 96.60 % dd if=/dev/zero of=/dev/sdd

The performance is slower than what I expect, only being ~10M/s write and it looks like the rest of the bandwidth is being taken up by reads. The disk is not mounted nor being used by any other program.

Is this expected with dd?

Ric Clark

Posted 2016-12-05T05:30:28.237

Reputation: 29

Question was closed 2016-12-12T16:54:29.233

I wonder if the /dev/zero input counts as a read. If you want to improve performance, using a buffer size would help, currently you are reading/writing a byte at a time: dd bs=1M if= of= – Paul – 2016-12-05T05:51:24.430

5Related? – Kamil Maciorowski – 2016-12-05T06:02:20.000

It appears that using bs and a count does just writes. Maybe without a count dd reads the disk in between writes to see if it is at the end. Kamil, that is exactly it, thanks! – Ric Clark – 2016-12-05T06:28:55.063

1I hope somebody provides a definitive answer to what is asked in the title, because I can't find actual documentation as to whether or not dd performs any verification of what it writes. – fixer1234 – 2016-12-06T01:06:54.057

Answers

2

You're not specifying the block size with the bs= parameter so dd writes in 512 bytes blocks.

Either your hard drive has 4096 bytes physical blocks (see https://superuser.com/questions/tagged/advanced-format), or the USB controller can't write in 512 bytes blocs but only bigger ones.

For every 512 bytes write that dd asks for the hard drive has to actually do a 4096 bytes read and a 4096 bytes write.

Sacha K

Posted 2016-12-05T05:30:28.237

Reputation: 877