Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
A way to get the offset of a current pending sector?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
luringen
n00b
n00b


Joined: 20 Aug 2014
Posts: 15
Location: Norwaaay

PostPosted: Wed Aug 20, 2014 3:00 pm    Post subject: A way to get the offset of a current pending sector? Reply with quote

I've got a harddive which have one current pending sector, this makes smartd send email warnings every time the box boots up, is there a way to get the LBA offset or something to the sector so i can fix this?

As i've understod, the sector is not remapped by the harddisk unless a write operation fails, so if i just write to it, it usually goes a way (i've done that before)

I take backup of the original data before i do this of course.

Thanks in advance.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54244
Location: 56N 3W

PostPosted: Wed Aug 20, 2014 5:03 pm    Post subject: Reply with quote

luringen,

Welcome to Gentoo.

If the system tries to read that sector, it will either fail and you will see the message including the LBA address in dmesg, or it will succeed and the sector well be remapped.
So you will see
Code:
[415753.356834] sd 0:0:0:0: [sda] Unhandled sense code
[415753.356838] sd 0:0:0:0: [sda]  Result: hostbyte=0x00 driverbyte=0x08
[415753.356843] sd 0:0:0:0: [sda]  Sense Key : 0x3 [current] [descriptor]
[415753.356850] Descriptor sense data with sense descriptors (in hex):
[415753.356854]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
[415753.356866]         bd dd ff 50
[415753.356872] sd 0:0:0:0: [sda]  ASC=0x11 ASCQ=0x4
[415753.356877] sd 0:0:0:0: [sda] CDB: cdb[0]=0x28: 28 00 bd dd fe d8 00 01 70 00
[415753.356888] end_request: I/O error, dev sda, sector 3185442640
[415753.356938] ata1: EH complete
on a fail.

A pending sector is one that the drive should have remapped already as it can no longer read whats there.

You may find that you get a lot more pending sectors if you try to read the entire drive surface.
Pending sectors are only the ones the drive knows about.

Start off by using ddrescue to make an image of the drive. It may recover your missing data.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
luringen
n00b
n00b


Joined: 20 Aug 2014
Posts: 15
Location: Norwaaay

PostPosted: Wed Aug 20, 2014 8:07 pm    Post subject: Reply with quote

NeddySeagoon wrote:
luringen,

Welcome to Gentoo.

If the system tries to read that sector, it will either fail and you will see the message including the LBA address in dmesg, or it will succeed and the sector well be remapped.
So you will see
Code:
[415753.356834] sd 0:0:0:0: [sda] Unhandled sense code
[415753.356838] sd 0:0:0:0: [sda]  Result: hostbyte=0x00 driverbyte=0x08
[415753.356843] sd 0:0:0:0: [sda]  Sense Key : 0x3 [current] [descriptor]
[415753.356850] Descriptor sense data with sense descriptors (in hex):
[415753.356854]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
[415753.356866]         bd dd ff 50
[415753.356872] sd 0:0:0:0: [sda]  ASC=0x11 ASCQ=0x4
[415753.356877] sd 0:0:0:0: [sda] CDB: cdb[0]=0x28: 28 00 bd dd fe d8 00 01 70 00
[415753.356888] end_request: I/O error, dev sda, sector 3185442640
[415753.356938] ata1: EH complete
on a fail.

A pending sector is one that the drive should have remapped already as it can no longer read whats there.

You may find that you get a lot more pending sectors if you try to read the entire drive surface.
Pending sectors are only the ones the drive knows about.

Start off by using ddrescue to make an image of the drive. It may recover your missing data.



Thanks for replying.

The kernel log is clean, and i can read the entire disk with dd without problems, its like it was just a one time read fail that made it mark it as a pending sector.

short and long selftests run without a problem. SMART error log and extended SMART LOG is clean. it shows no sign of failure. it is also a part of a RAID5 array so there is no need to using ddrescue.

My main question is if there is a smartctl command or something to get the address of the pending sector.

It marked the sector as a pending sector just yesterday but i've had this problem before, where a harddrive had a pending sector for half a year before i reinserted it in a raid array, which made it resync and read+write the sector again so it was marked clean.

Bottom line is, the drive shows no signs of failure, neither in kernel log or smart log. It only has a little annoying pending sector.

Again, thanks for response.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54244
Location: 56N 3W

PostPosted: Thu Aug 21, 2014 3:54 pm    Post subject: Reply with quote

luringen,

I'm not sure the drive knows where the pending sector is. That data item is just a count of the sectors the drive would like to relocate.
It won't actually attempt the relocation until the sector is accessed.

I've seed failed drives with hundreds of pending sectors.

Try running a repair on the raid set.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
luringen
n00b
n00b


Joined: 20 Aug 2014
Posts: 15
Location: Norwaaay

PostPosted: Thu Aug 21, 2014 6:41 pm    Post subject: Reply with quote

check and repair returns 0 mismatches, so im pretty sure its ok... for now.
Thank you.
Back to top
View user's profile Send private message
pa1983
Tux's lil' helper
Tux's lil' helper


Joined: 09 Jan 2004
Posts: 101

PostPosted: Fri Aug 22, 2014 1:54 am    Post subject: Reply with quote

start by emerging smartmontools

Then run smartctl -a /dev/sdX (X is your hard drive say a or b etc)
That will spit out all the SMART data available.

Now you realy want to look at just the values of the SMART data and you can do that by using -A flag.

smartctl -A /dev/sdX

If you have one or more pending sectors that means the hard drive once had a problem reading or writing to it so it marked it as suspicious.

So pending means that if it finds a problem with writing to it later it MIGTH replace it with a new one.
Pending sectors will only be replaced if a write fails not a read.
Also the way some firmwares works some sectors can be pending for all time from what I have read.

Now there is a way to find the LBA of one or more pending sectors IF they are faulty. Usually they are.

All hard drives with SMART capability should be able to run a built in self test. Smartmontools can activate it.

run this command.

smartctl --test=long /dev/sdX

That will start the self test.
To check progress just type

smartctl -a /dev/sdX

and it will tell you how many percent remains. Can take up to 4h to read the howl drive.
If it finds a bad sector it will stop the test and permanently write out in the SMART log how fare it progressed before failure and at what LBA it failed.

Now once you know the LBA you can force a write to that LBA and by doing so force it to be replaced (and since the old sector was bad the data was lost so there is always a risk to the filesystem and files to be damaged from bit rot due to pending sectors), I dont remember the procedure from my head but there are guides out there for doing just this. You need to write to the LBA so you need to calculate the actual sector if I recall and force a write to it if you wish to scan the rest of the drive for more faults.
Problem is every time the self test finds a pending sector that was bad it will stop and you have to do it all over again so it can realy take a long long time and in the end you might realize the drive is FUBAR any way.
I have don this for drives with single pending sector faults back in the day.
Last time I had a drive with 24 pending sectors. I didn't even bother I sent it in and a got a new one even when the warranty had expired with 4 days.

So in reality what you want to do is run the "smartctl --test=long /dev/sdX" and HOPE that the pending sectors you had is readable that way it should pass at 00% remaining and the pending sector count should go back to 0 after some time. If not it will fail at some point and at that point that Hard drive if warranty exist should go in for RMA and if warranty has expired I would only use it for non important data like temporary stuff.

I have never had any complaints once I had a confirmed bad sector, since the drive logs them its strait forward for any technician to verify.

I would not trust any program to test the drive. Some drives have crap SMART status like seagate but the self test (run by the disk it self not smartmontools) is pretty strait forward, read every sector and if it fails on just one the disk will record the error.
I even think my crucial SSD runs a self test periodically by default.

EDIT:

If you find a bad sector and realy would like to force the disk to replace it try this guide. Think it was the one I used long ago.
http://smartmontools.sourceforge.net/badblockhowto.html

I also found this but have not read it.

http://kaivanov.blogspot.se/2010/09/fixing-disk-problems-under-linux-with.html
_________________
NAS: i3 4360 3.7Ghz, 20Gb ram, 256Gb SSD, 65Tb HDD, NIC: Intel 2x1Gbit, Realtek 2.5Gbit
ROUTER: J1900 2Ghz, 8Gb ram, 128Gb SSD, NIC: 2x1Gbit, WIFI: Atheros AR9462 and AR5005G
Back to top
View user's profile Send private message
luringen
n00b
n00b


Joined: 20 Aug 2014
Posts: 15
Location: Norwaaay

PostPosted: Fri Aug 22, 2014 9:56 am    Post subject: Reply with quote

Thanks, but as I've stated the long or extended self test completes without error.
after that the number of pending sectors is still 1 after a successful test. I am experienced with failing drives and smartmontools.

But thanks for posting, i believe i got my answer from NeddySeagoon who stated that the drive does not know where the pending sector is, just that it has seen one.
Back to top
View user's profile Send private message
pa1983
Tux's lil' helper
Tux's lil' helper


Joined: 09 Jan 2004
Posts: 101

PostPosted: Sat Aug 23, 2014 6:43 am    Post subject: Reply with quote

Since the long self test reads all sectors the sector obviously works right?
Have you run "smartctl -t offline /dev/sdX" to force a SMART update?
If you do that the pending sector count might go back to 0 after a long self test has passed. That is what I have done before.
Like I sad some hard drives dont update SMART predictable.
Depending on firmware you might be stuck with that pending sector for all time to from what I read but I have never had that scenario my self tough.
_________________
NAS: i3 4360 3.7Ghz, 20Gb ram, 256Gb SSD, 65Tb HDD, NIC: Intel 2x1Gbit, Realtek 2.5Gbit
ROUTER: J1900 2Ghz, 8Gb ram, 128Gb SSD, NIC: 2x1Gbit, WIFI: Atheros AR9462 and AR5005G
Back to top
View user's profile Send private message
luringen
n00b
n00b


Joined: 20 Aug 2014
Posts: 15
Location: Norwaaay

PostPosted: Sat Aug 23, 2014 12:12 pm    Post subject: Reply with quote

long/offline selftest has passed multiple times, still 1 pending sector.
guess i'll just wait for it to get older :P

Thanks for replying.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum