If you want to erase a harddrive, dd does not delete the content of reallocated sectors, and is very slow if the harddrive is dying. Instead you can use the drives build in erase function, which has been standardized for a long time.
In this example, I am erasing a 500GB mechanical harddrive in only 102 minutes. Even when it is full of reallocated sectors:
root@ubuntu:~# hdparm --security-set-pass Eins /dev/sdaj security_password="Eins" /dev/sdaj: Issuing SECURITY_SET_PASS command, password="Eins", user=user, mode=high root@ubuntu:~# time hdparm --security-erase-enhanced Eins /dev/sdaj security_password="Eins" /dev/sdaj: Issuing SECURITY_ERASE command, password="Eins", user=user real 102m22.395s user 0m0.001s sys 0m0.010s root@ubuntu:~# smartctl --all /dev/sdaj | grep Reallocated 5 Reallocated_Sector_Ct 0x0033 036 036 036 Pre-fail Always FAILING_NOW 1327
You can see more details at ata.wiki.kernel.org, however their example don't use --security-erase-enhanced, which is necessary to delete the before mention reallocated sectors.