Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#24375 - [libatasmart] patch to use vendor supplied threshold for reallocated blocks

Attached to Project: Arch Linux
Opened by Evangelos Foutras (foutrelis) - Saturday, 21 May 2011, 15:07 GMT
Last edited by Evangelos Foutras (foutrelis) - Monday, 31 October 2011, 17:42 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan de Groot (JGC)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



I started getting warnings regarding the health of my main hard disk drive (disk-warning.png). It appears to have 54 reallocated blocks on it.

However, Seagate advises that a few reallocated sectors are nothing to replace a disk for. From [1]:

"Current disk drives contain thousands of spare sectors which are automatically reallocated if the drive senses difficulty reading or writing. [..] Spare sector reallocation is a normal intelligent drive operation."

After some researching, I came across a bug [2] in Ubuntu that discusses these false positives given by libatasmart. To decide if there are too many reallocated sectors, libatasmart compares the number of reallocated sectors against sector_threshold. sector_threshold is calculated as the base-2 logarithm of the total number of sectors on the disk.

My 500GB disk has 976773168 sectors in total, so sector_threshold is equal to log2(976773168) which is about 30. This value is too low, and therefore the disk's 54 reallocated sectors are misinterpreted as an imminent disaster. :D

Debian and Ubuntu (maybe others too) have patched libatasmart so it won't use the above heuristic to determine whether the number of reallocated sectors is too high. As far as I can see, with the patch applied libatasmart will simply compare the normalized value against the threshold value. This is the behavior I would expect.

In the attached [disk-incorrect-status.png] you can see the disk report before applying the patch, and the after is in [disk-correct-status.png].

May I suggest we apply these patches too, possibly saving a few people the trouble and cost of replacing a perfectly good disk? :)

(The first patch makes querying a bit quicker, but I included it anyway as not to have to modify the second patch which didn't apply without the former.)

Additional info:
* package version(s): libatasmart 0.17-1

This task depends upon

Closed by  Evangelos Foutras (foutrelis)
Monday, 31 October 2011, 17:42 GMT
Reason for closing:  None
Additional comments about closing:  Suggested patch was not accepted upstream, and a different workaround has been included in libatasmart 0.18-1.
Comment by Evangelos Foutras (foutrelis) - Monday, 31 October 2011, 17:40 GMT
Upstream has decided to implement a different workaround (included in libatasmart 0.18):;a=commitdiff;h=8f5648e829bbb83d1d4f670c232ff8d738dd0cc7

Meh, at least I don't get warnings for a petty 54 reallocated sectors anymore. :p