Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

A way to get the offset of a current pending sector?

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
9 posts • Page 1 of 1
Author
Message
luringen
n00b
n00b
Posts: 15
Joined: Wed Aug 20, 2014 2:53 pm
Location: Norwaaay

A way to get the offset of a current pending sector?

  • Quote

Post by luringen » Wed Aug 20, 2014 3:00 pm

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.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56094
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Aug 20, 2014 5:03 pm

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: Select all

[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.
Top
luringen
n00b
n00b
Posts: 15
Joined: Wed Aug 20, 2014 2:53 pm
Location: Norwaaay

  • Quote

Post by luringen » Wed Aug 20, 2014 8:07 pm

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: Select all

[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.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56094
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Thu Aug 21, 2014 3:54 pm

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.
Top
luringen
n00b
n00b
Posts: 15
Joined: Wed Aug 20, 2014 2:53 pm
Location: Norwaaay

  • Quote

Post by luringen » Thu Aug 21, 2014 6:41 pm

check and repair returns 0 mismatches, so im pretty sure its ok... for now.
Thank you.
Top
pa1983
Tux's lil' helper
Tux's lil' helper
Posts: 101
Joined: Fri Jan 09, 2004 8:39 pm

  • Quote

Post by pa1983 » Fri Aug 22, 2014 1:54 am

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/fix ... -with.html
Gentoo server: R5 5600G 4.4Ghz, 32GB ram, 8TB SSD, 76TB HDD, NIC: 10Gbit + 2.5Gbit
Top
luringen
n00b
n00b
Posts: 15
Joined: Wed Aug 20, 2014 2:53 pm
Location: Norwaaay

  • Quote

Post by luringen » Fri Aug 22, 2014 9:56 am

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.
Top
pa1983
Tux's lil' helper
Tux's lil' helper
Posts: 101
Joined: Fri Jan 09, 2004 8:39 pm

  • Quote

Post by pa1983 » Sat Aug 23, 2014 6:43 am

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.
Gentoo server: R5 5600G 4.4Ghz, 32GB ram, 8TB SSD, 76TB HDD, NIC: 10Gbit + 2.5Gbit
Top
luringen
n00b
n00b
Posts: 15
Joined: Wed Aug 20, 2014 2:53 pm
Location: Norwaaay

  • Quote

Post by luringen » Sat Aug 23, 2014 12:12 pm

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.
Top
Post Reply

9 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic