Can I continue using a partially corrupt hard drive by stripping out the bad sectors?
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?
Solution 1:
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.
Solution 2:
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.
Solution 3:
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.