I am dual booting Ubuntu 12.04 and Windows 8. Earlier today, after restarting due to some input issues, I started getting the message upon selecting Ubuntu from GRUB, "errors were found while checking the disk drive for /". I opted to ignore it, and Ubuntu loaded as normal. Upon checking the Disk Utility tool, I see the SMART status "Disk has a few bad sectors". When checking the specific information, I am given a warning for "Current Pending Sector Count". What does this mean? Should I allow an automated attempt to fix the issue? I've had further trouble caused by allowing automated fixes to run before because of conflicts with Windows 8 and UEFI, but I have no idea if there is any association between that and this issue. I can't imagine this is due to physical hard drive damage, as it is very new hardware. Thanks to anyone who can explain it.
Sometimes sudden power failure can result in one sector being reported as bad because it didn't get completely written. You can run
sudo smartctl -t long /dev/sda to ask the drive to test itself. Check the status every once in a while with
sudo smartctl -a /dev/sda and when it finds a bad sector, note the sector number, then do:
sudo dd iflag=direct if=/dev/sda count=1 skip=sector of=/dev/null
That should report an IO error, if not then something is wrong and you should not proceed.
sudo dd if=/dev/zero count=1 oflag=direct of=/dev/sda seek=sector
This will try to re-write that sector full of zeros. This should succeed and the SMART pending_sector count should drop by one. If the sector was physically damaged, then the reallocated_count will go up by one. Repeat the process until you have no more pending sectors and if you have no reallocated sectors either, then it was just sudden power loss, and the drive is fine. If you do have reallocated sectors, then then drive may be on its way out and you should replace it.
There are several duplicates of this question, such as:
- What to do if Disk Utility shows bad sectors pending in SMART?
- I dropped my laptop. SMART says there are bad sectors. Can I fix this?
- I have 4029 bad sectors. Should I worry?
- SMART Disk Failure 05 - Reallocated Sector Count: Creating a Partition Ubuntu 12.04
Unfortunately, the answers vary. My own opinion is that, once bad sectors start showing up in a SMART test, the disk has become unreliable. I therefore recommend replacing it ASAP.
Following psusi recommendation, I succeeded clearing my "bad sector".
For more details for beginners:
sudo smartctl -t long /dev/sda sudo smartctl -a /dev/sda
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0 197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 1 (...) # 1 Extended offline Completed: read failure 90% 47004 2730908512 sudo dd iflag=direct if=/dev/sda count=1 skip=2730908512 of=/dev/null
Gave me an error, but:
sudo dd if=/dev/zero count=1 oflag=direct of=/dev/sda seek=2730908512
sudo smartctl -a /dev/sda
Gave me no more errors:
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0 197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0
So, thank you very much psusi for your reply, years later it's still useful :-)