Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I got a notification today that my drive was going to fail in 24 hours. The 'Reallocated_Sector_Ct' was already around 3000 and it has since risen to over the last few hours 4004. However, I turn my case on its side a few weeks ago, and tried turning it back upright. Since then, the 'Reallocated_Sector_Ct' hasn't risen, even though currently there's a lot of disk activity as I'm tar/zipping my important data to another drive.

I know having a hard disk not being able to read on it's side is a concern, but if placing the hard drive upright seems to fix the issue for the moment, at least I don't have to panic as much.

Is there a way I can run a retest on those "bad sectors", and remark them as good if they pass the test? I'd like to see how many "really" bad sectors there are after a retest with the box upright (of course I'll do this after my backup is complete).

I'm using Debian if that makes any difference.

share|improve this question
add comment

3 Answers

Turn off the machine, and get a replacement disk now! Bad sectors in hard disks tend to grow exponentially, massive data loss is inminent.

share|improve this answer
    
The number of bad sectors hasn't grown past 4004 since I re-orientated the disk. I have a feeling this was a temporary issue, as there's been no growth over the last 24 hours. –  Clinton Jan 21 '13 at 14:50
    
OK, it's your data... –  vonbrand Jan 22 '13 at 20:29
    
Vonbrand: You were right, the disk failed. I did save the data though. –  Clinton Mar 25 '13 at 0:05
add comment

I can only second the answer from vonbrand. I've seen at least two HDDs die in the past month after going to pre-fail in SMART.

However, your best bet is probably not SMART itself but instead the badblocks utility.

You can let badblocks read and rewrite the whole disk, thereby forcing your HDD to reallocate pending sectors. This usally works quite well.

If you don't have the time for running badblocks (It can take days on bigger disks) you can try to read out the SMART error log (smartctl -x /dev/<hdd> and get a list of broken sectors.

You can then use hdparm to read the sector:

hdparm --read-sector <sector> /dev/<hdd>` 

If that fails you force a remap using

hdparm --yes-i-know-what-i-am-doing --write-sector <sector> /dev/<hdd>` 

This works quite well (at least for WD-Green drives, can't you tell anything about other drives)

If you have dmesg log messages for failed sectors it's even easier.

sectors=$(dmesg | grep <hdd> | grep sector | awk '{print $8}')

for s in $sectors; do <hdparm stuff>; done

Before mounting the volume again do a forced fsck

fsck -f -y /dev/<hdd> 

And assume to have the drive dying on you yesterday!

Good Luck :)

share|improve this answer
add comment

I don't believe it's possible to re-test sectors which the drive has already marked as bad and re-mapped. That would be "send it back for warranty" territory. (E.g. theoretically the vendor may have tools that can validate and reset such a drive).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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