Reallocating bad sectors

Questions about hardware,drivers and peripherals
Forum rules
Before you post please read this

Reallocating bad sectors

Postby Jesse_V on Sun Feb 10, 2013 8:20 pm

Hello everyone,

First off, I've been using Linux Mint for about six months and I think it's absolutely brilliant. I currently run Mint 14 with the Cinnamon desktop, and I really like the setup. I'm getting pretty well-versed in the command-line, and I liking have the level of control that Linux offers above Windows.

My question concerns identifying and reallocating bad sectors on my hard drive. I've done a good amount of research and read up on a lot of related tools. My end goal is to use GParted to move a data partition in my hard drive to give 40 more gigabytes to my main Linux partition. Before moving the partition, GParted performs a read-only test, and it keeps encountering a IO error while doing this. It's obvious that I have a bad sector in that partition, so I want to reallocate it (I'm aware that I can't repair/fix it). The tools I started to use were Disks, smartctl, hdparm, and badblocks. I did a quick SMART test using Disks, and it failed. Disks does not seem capable of telling me exactly why it failed, so I ran "sudo smartctl -a /dev/sda" and among lots of other information, it gave me:
Code: Select all
SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed: read failure       90%      9056         529813637
# 2  Short offline       Completed: read failure       90%      9056         529813637
# 3  Short offline       Completed: read failure       90%      9056         529813637
# 4  Short offline       Completed: read failure       90%      9052         529801065
# 5  Extended offline    Completed: read failure       90%      9052         529801065
# 6  Short offline       Completed: read failure       90%      9052         529801065
# 7  Extended offline    Completed: read failure       90%      9052         529801065
# 8  Extended offline    Completed: read failure       90%      9052         529802003
# 9  Extended offline    Completed: read failure       90%      9052         529802003
#10  Extended offline    Completed without error       00%      7167         -
#11  Extended offline    Completed: read failure       90%      6587         447167822
#12  Short offline       Completed: read failure       90%      6438         447166731
#13  Extended offline    Completed: read failure       90%      6438         447166731
#14  Extended offline    Completed: read failure       90%      6438         447166731
#15  Extended offline    Completed: read failure       90%      6438         447166731
5 of 14 failed self-tests are outdated by newer successful extended offline self-test #10


But sector 447166731 is just fine, because I ran "sudo hdparm --read-sector 447166731 /dev/sda" and got
Code: Select all
/dev/sda:
reading sector 447166731: succeeded


I then scanned the drive with badblocks, which produced a number of sectors that badblocks had problems with (block size 512, as I saw below). I tested those with hdparm, and they read just fine. This is getting frustrating and I'm getting confused. Why do badblocks and smartctl report sectors that are actually fine? I remember successfully using these tools before to reallocate bad sectors, so am I doing something wrong this time? Do I need to reset a flag on the hard drive? All I really need to do is find the bad sectors, because then I can use hdparm --write-sector to write over them, forcing the drive to reallocate.

My Linux partition is ext4, and it seems fine. The data partition which I wanted to move is formatted with NTFS because its data is also used by my Windows partition. Here's the specs on my hard drive, if it matters:
Code: Select all
sudo smartctl -i /dev/sda

smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.7.0-7-generic] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Momentus 7200.4
Device Model:     ST9320423AS
Serial Number:    5VH0YQAW
LU WWN Device Id: 5 000c50 01c60c7c0
Firmware Version: 0002SDM1
User Capacity:    320,072,933,376 bytes [320 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 4
Local Time is:    Sun Feb 10 17:11:06 2013 MST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


Hopefully I posted in an appropriate section. Please let me know you guys need any further information.
Folding@home article on Wikipedia, a Featured Article
Never doubt that a small group of thoughtful, committed citizens can change the world. Indeed, it is the only thing that ever has. -Margaret Mead
Jesse_V
Level 1
Level 1
 
Posts: 9
Joined: Thu Feb 07, 2013 2:12 pm
Location: USU, Logan, UT. Hometown: Big Lake, Alaska

Linux Mint is funded by ads and donations.
 

Re: Reallocating bad sectors

Postby Jesse_V on Wed Feb 13, 2013 10:08 pm

Anyone have any ideas on this? I'm trying to get this figured out and any suggestions would be appreciated. :)
Folding@home article on Wikipedia, a Featured Article
Never doubt that a small group of thoughtful, committed citizens can change the world. Indeed, it is the only thing that ever has. -Margaret Mead
Jesse_V
Level 1
Level 1
 
Posts: 9
Joined: Thu Feb 07, 2013 2:12 pm
Location: USU, Logan, UT. Hometown: Big Lake, Alaska

Re: Reallocating bad sectors

Postby srs5694 on Thu Feb 14, 2013 11:23 am

Replace that hard disk. IMMEDIATELY!

Modern disks include "transparent" error detection and correction facilities that can handle a modest number of bad blocks without you ever being aware of the problem. Only when those facilities become overwhelmed by a huge number of problems do you start to see read errors in tools like "badblocks", which was designed with older and less sophisticated disks in mind. When a disk starts encountering such a large number of bad blocks, the cause is frequently some sort of cascading failure that results in more and more bad blocks over time, sometimes with a catastrophic failure that will render the disk 100% useless with no additional warning. You've already gotten the warning in the form of the SMART test that reports numerous errors and in read errors in normal operation.

It's conceivable that you could get additional life out of that disk, but it's also possible that it will fail completely today. Thus, it's simply not safe to continue using the disk, except perhaps in some sort of test or low-importance role (doing test installations of new distributions, for instance).
srs5694
Level 6
Level 6
 
Posts: 1020
Joined: Mon Feb 27, 2012 1:42 pm

Re: Reallocating bad sectors

Postby Jesse_V on Thu Feb 14, 2013 12:11 pm

srs5694 wrote:Replace that hard disk. IMMEDIATELY!

Modern disks include "transparent" error detection and correction facilities that can handle a modest number of bad blocks without you ever being aware of the problem. Only when those facilities become overwhelmed by a huge number of problems do you start to see read errors in tools like "badblocks", which was designed with older and less sophisticated disks in mind. When a disk starts encountering such a large number of bad blocks, the cause is frequently some sort of cascading failure that results in more and more bad blocks over time, sometimes with a catastrophic failure that will render the disk 100% useless with no additional warning. You've already gotten the warning in the form of the SMART test that reports numerous errors and in read errors in normal operation.

It's conceivable that you could get additional life out of that disk, but it's also possible that it will fail completely today. Thus, it's simply not safe to continue using the disk, except perhaps in some sort of test or low-importance role (doing test installations of new distributions, for instance).

Thanks for the information. The reallocation on modern disks only occurs during write operations, correct?

I still think it's odd that badblocks says a particular sector is bad, but hdparm can read it all right. I've only got a few reallocated sectors, so it's not like badblocks tries to read the old location for a sector and hdparm reads the sector in it's new location after reallocation. I still don't know what's up with that.

I'll look into replacing the drive and figuring out how to transfer everything over. I've got three major partitions: Windows 7, Linux Mint, and data. The data shouldn't be a problem, but it's the OSs that are going to be more difficult.
Folding@home article on Wikipedia, a Featured Article
Never doubt that a small group of thoughtful, committed citizens can change the world. Indeed, it is the only thing that ever has. -Margaret Mead
Jesse_V
Level 1
Level 1
 
Posts: 9
Joined: Thu Feb 07, 2013 2:12 pm
Location: USU, Logan, UT. Hometown: Big Lake, Alaska

Re: Reallocating bad sectors

Postby viking777 on Thu Feb 14, 2013 12:55 pm

I still think it's odd that badblocks says a particular sector is bad, but hdparm can read it all right


I wouldn't consider that to be unusual. If you want a parallel have a look at the output of du and df (or the disk usage analyzer and gparted) I can pretty well guarantee they will all give you different results for free and used space on a disk. This is no different.

but it's the OSs that are going to be more difficult.


Shouldn't be. That is what disk cloning tools exist for. Clonezilla would be my choice for whole disk images, but if you want to treat each partition separately then qt4-fsarchiver is my favourite although I am told that redobackup is good as well (in both modes). As long as you are only changing disks (not computers) disk images or clones should work for you.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am


Return to Hardware Support

Who is online

Users browsing this forum: No registered users and 22 guests