31

I have a hard disk which started failing. I tested the hard disk using the in-build hardware diagnostic tool which the Dell laptop shipped with and it told me it has bad sectors. So, I understand that these are sections that cannot retain memory. I am curious if I could avoid these sectors by creating volumes around them and continue using the hard disk to pull in a few more years? I removed the hard disk and connected it as an external and am currently running a program 'badblocks' via my mac laptop to determine the number of badblocks. Would it be feasible for me to strip out the bad sections and use the good ones alone?

I intend to re-install Windows 10 into this 500gb hard drive for my Dell laptop. So I'm thinking I could use badblocks to determine which range of sectors are "bad"--say, for example, if the first 100GB are good and there are bad blocks between the 100021570765 byte to the 166702617940 byte, then could I just use the Windows partitioning tool during install to create a 100GB partition, then a 70 GB partition (which contains the bad blocks) and then a 3rd partition with the remaining space. And then format only partition 1 and 3 into volumes so that the unallocated space encapsulates all the bad blocks?

5 Answers5

55

Technically yes. Similar methods have been in use for 50 years, and this is actually in part the purpose of the 'badblocks' tool (its output can be directly embedded when formatting a partition using ext2/ext4). Even Windows itself keeps track of bad sectors – if chkdsk finds any, it assigns them to a hidden file named "$BadClus" so that they never get reused for any other file.

However, modern HDDs have enough hidden "spare" space that they'll automatically remap bad sectors elsewhere before the OS. This happens as soon as you write to a sector that's been marked bad – its logical address remains the same, but physically it now goes to a spare area. (SMART will show you a counter of remapped sectors.)

So in practice you won't need to do this until the number of bad sectors rises to the point that there's no more space to remap them to. And when you reach that point of no remap, then the disk has already become so bad that using it as your main system disk would be unnecessarily risky.

grawity
  • 501,077
23

Your hard drive is probably already doing this at a hardware level. When there are enough bad sectors for the OS to notice, it's time to replace the drive.

Laurence
  • 357
19

Hard disks are already doing it in their own firmware. When a bad block is detected, they are marking it inside the "bad block map", and instead of the bad block sector, they're using a good sector stored in a spare area (i.e. all disks come with some buffer of space not possible to be accessed by the operating system; this spare space is only used when a bad block is detected).

That was an answer for 'can I do it', but the answer for 'should I do it' is definitely no. If a hard disk starts producing bad blocks, something has already gone wrong. There is a chance it will produce additional bad blocks exponentially, up to the point the hard drive will not be detectable by the OS. This doesn't mean that this will happen for sure, but nobody really can say for sure this will or will not happen to your particular drive. The bottom line is, if bad blocks are happening, then replace the drive.

antekone
  • 298
5

While the other answers deal with how hard disks, the OS, and other potential bad block tools handle these bad blocks. Before you take the decision to replace and discard the hard disk, it's worth checking if the disk is still under warranty. Some manufacturers give very long warranties. For example, Seagate up to 5 years, WD up to 3 years.

Holmez
  • 159
-1

I wouldn't throw out a disk after a single bad sector. The cut-off depends on the use case. If 10-100 bad sectors (but way less than 1% drive space) I wouldn't use the disk by itself, but I would use it in RAID 1, aka mirror.

RAID is feasible in mid-tower desktops and servers. As a general rule laptops shouldn't use RAID. You also can't use RAID over USB. (I've seen a few huge gaming laptops that support RAID, but they're the exception that proves the rule.)

In addition to purchase cost there's the energy cost of running older drives. Every time the disk discovers a sector has gone bad it means the disk has to rewrite that block of data multiple times. Bad sectors can show up "in a row", which means drive is active longer. But worse than energy use large files copies can start taking a LONG time, especially if you're using multiple old disks in RAID 0, which can amplify the number of bad sectors hit per large file operation. And RAID is notoriously picky about how long an operation should take. So if you put a drive with some bad sectors into RAID 0 you're making much more likely the whole file copy will fail.

Drobo and other pro-sumer multi-drive NAS boxes have optimizations that might handle partially-failing drives better than internal RAID controllers. These NAS are called JBOD, short for "just a bunch of disks". If you have more than 1 of these drives with bad sectors and not ready to throw them out you should give these NAS/JBOD boxes a look. They can keep multiple copies of your data across multiple disks.

If you have many disks that are the same model or manufactured at the same time then many drives can go down-hill at the same time, causing a cascading failure and data loss. But as long as the older drives are a mix of manufacturers and models you're unlikely to lose many drives at once in JBOD.

yzorg
  • 785