How to erase a hard drive with unwritable sectors?

try ddrescue instead of dd - it tries harder with errors


Parameters I used with ddrescue to erase drive /dev/sdb (filled with zeros from /dev/zero) and log output into file log.txt:

ddrescue --force /dev/zero /dev/sdb log.txt

If you are just looking to wipe the drive try dban

From the site:

Darik's Boot and Nuke ("DBAN") is a self-contained boot disk that securely wipes the hard disks of most computers. DBAN will automatically and completely delete the contents of any hard disk that it can detect, which makes it an appropriate utility for bulk or emergency data destruction.