Does dd give me an error at the end of zero-writing a disk

cygwin;ddhard drivewipezero-write

I'm running Cygwin on Windows 7.

I was using the following dd command to securely erase a 1TB mechanical disk:

dd if=/dev/zero of=/dev/sde bs=4M status=progress

About 2 and a half hours into the wipe, around the time I was expecting it to complete and after successfully writing about 930GB (or GiB, more likely) to the disk, I got the error:

dd: error writing '/dev/sde': Input/output error

I ran the command again with seek to try and reproduce the error by zero-writing the last few gigabytes of the file:

dd if=/dev/zero of=/dev/sde bs=4M status=progress seek=231100

…and sure enough I got the same error:

dd: error writing '/dev/sde': Input/output error
7368+0 records in
7367+0 records out
35196174335 bytes (35 GB, 33 GiB) copied, 405.703 s, 86.8 MB/s

It seems that the wipe ran successfully, but if that was the case, then why is the error being generated?

Is it normal? If not, how can I avoid it?

Best Answer

My guess would be a bad sector. AFAIK that's one of the cases that could lead to I/O error.

Anyway, it is unlikely that the error is given is because dd was trying to write past the end of the drive. Even with my answer to your another question, you should still see No space left on device instead:

enter image description here

For the record, because of the Cygwin bug, 35196174335 is unlikely the actual number of bytes that have been written. Instead, it should be 35196174335 - 4294967295 = 30901207040. (You can try to "mod" these numbers against 512.)

In that case, the number of bytes / sectors that have been successfully written should be 231100 * 4 * 1024 ^ 2 + 30901207040 = 1000204861440 / 1953525120. Base on other information that you have given in your questions, this is unlikely the size of the entire drive anyway. (It might be worth mentioning that 30901207040 bytes is not "4M" (4 * 1024 ^ 2) divisible either.)

Related Question