30

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?

9
  • 8
    This already happens automatically. Bad sectors are marked as unavailable for the file system. The problem is that in most cases, the amount of bad sectors will keep increasing - you're going to lose your real, presumably valuable, data.
    – Luaan
    Jun 22, 2020 at 6:43
  • Another fun fact about consumer devices. Many cheap consumer hard disks lack the control logic to control the "retry" logic on the hard disk controller. The result is that the hard disk might spend minutes trying to read the same bad sector over and over again. As you can imagine, this can have detrimental effects on your ability to read data off the disk again...
    – Aron
    Jun 22, 2020 at 11:00
  • 8
    Been there, done that. Let me tell you: What you have essentially made is a time bomb waiting to destroy your data. Just get a new one and replace it with an SSD while you are at it.
    – Num Lock
    Jun 22, 2020 at 11:06
  • As otehrs have already said, whilst in theory you could possibly get a little longer out of your disk, how long it will last will more likely be measured in days (or weeks if you're lucky) rather than years. And there is still risk of data loss/corruption. Jun 23, 2020 at 7:08
  • 2
    @NumLock SSDs are even more of a time bomb - at least a mechanical drive usually lets you know before it's dead that it's starting to die. With an SSD you just wake up one day and your drive is a brick. Nothing substitutes for a backup.
    – J...
    Jun 23, 2020 at 16:04

5 Answers 5

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.

4
  • 52
    Hard drives are insanely cheap compared to their data. If remapped sectors start showing up in SMART at all, just replace the drive. Jun 21, 2020 at 0:49
  • 5
    Any reallocated sector count above 0 is grounds for a warranty claim. You should replace the drive long before it gets to the point described in the question. Jun 22, 2020 at 3:50
  • 4
    I strongly suspect OP's disk is old enough to no longer be under warranty...
    – user1686
    Jun 22, 2020 at 5:38
  • Hard drives with bad blocks are the reason for system slowdowns. A hard drive with bad blocks count > 0 can be used only as an archive hard drive for general purpose data, on a shelf. Apr 18, 2021 at 6:23
22

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.

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.

4
  • 5
    2nd paragraph especially important: If you start getting bad blocks/corrupt data the only thing to do is get your data off of it ASAP. As in: immediately. Things will get worse fast, then faster. 🢀 (ask me how I know) BTW: This isn't OP's use case, but, if you have more than one HDD in a case, bought and installed at the same time, and one starts going bad: replace them all! 🢀 (ask me how I know)
    – davidbak
    Jun 22, 2020 at 4:48
  • Additionally, there may be a period of time where you can actually recover data from the damaged drive (the last time I tried, it took something like eight hours to read a few megabytes of data, but all of it ended up perfectly fine). This will quickly go away too.
    – Luaan
    Jun 22, 2020 at 6:46
  • 1
    @davidbak (last part only applies if they're the same model of hard drive, or at least the same brand)
    – user253751
    Jun 22, 2020 at 11:26
  • So much this! It cracks me up how many servers are built with identical drives from the same batch, placed into service at the same time... And folks wonder why they fail simultaneously!
    – docwebhead
    Jun 23, 2020 at 13:54
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.

0
-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.

3
  • 2
    If you're seeing a single bad sector, that means the firmware has already reallocated hundreds or thousands of bad sectors, and has run out of space for dealing with new ones.
    – Mark
    Jun 22, 2020 at 23:51
  • @Mark That would be true if operations were failing because of bad sectors, but OP said the diagnostic tool is reporting the bad sectors, so I thought he's talking about the "firmware has already relocated" type of badies. Same could be said if seen via SMART reporting: if you ask for drive health it should tell you the internal relocations before any file I/O operations have failed.
    – yzorg
    Jun 23, 2020 at 13:12
  • @Mark I agree that if file operations have started to fail then you're beyond any safe use, which was in the OP. But writing this for others that might be reading this page during the diagnostic/SMART reporting stage.
    – yzorg
    Jun 23, 2020 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.