How to quickly format a HDD with bad sectors (in linux)

bad-blocksbad-sectorsformattinghard drive

I have a SATA HDD, which has bad sectors. I do not need the data, and need to format the HDD to create a fresh device.

I tried to repair the HDD problem with commands like

fsck.ext4 -p /dev/sda1

but it takes ages to fix the sectors. I formatted the entire HDD, but still have the problems. Is there a quick way to format the HDD and restore bad sectors?

Best Answer

No, there is no quick way. Generally, when you have a disk with some bad sectors, you should overwrite the total contents of your disk, with a command similar to this:

dd bs=512k if=/dev/zero of=/dev/...

It'll take some time (2-3 hours normally). Doing this will give your disk a chance to handle bad sectors. A modern disk (made in the last ~15 years) handles bad sectors internally, transparently remapping those sectors from a reserved set of sectors during writes. So in the end, you should have a disk with all sectors usable. If the disk cannot do this remapping, it usually means that there are so many bad sectors that it ran out of reserved sectors. This is a clear indication that the disk has reached end of life.

Related Question