Input/output error

Stefan Bethke stefan.bethke at
Sun Nov 24 22:34:00 GMT 2002

Am Sonntag, 24.11.02, um 21:10 Uhr (Europe/Berlin) schrieb Paul Civati:

> "Rob King" <robking at> wrote:
>> So i ran a dmesg - and to my surprise... (I've pulled out the relevant
>> lines):
>> ad4s1e: hard error reading fsbn 159012031 of 79505984-79506111 (ad4s1
>> bn 159012031; cn 9898 tn 10 sn 31) trying PIO mode
> Right.. that looks like bad media/sectors.
>> Anyone any ideas? I'm not having much luck with IBM drives at the 
>> moment
>> - at least one goes a year - this'll be my second!
> Well, this is tricky I think, because you're using IDE/ATA.
> Basically you need to map out those bad sectors to stop the o/s trying 
> to use them, with SCSI disks you would eg. go into the Adaptec SCSI 
> bios and run a verify, and it would scan the disk and mark any bad 
> sectors as unusable.

> I'm not sure how modern IDE/ATA drives handle bad media, but the above 
> is what I gleaned when I went through the problem.
> Anyone know otherwise?  Time to ask google I think..

This only applies to *very* old drives. Anything produced in the last 
10 years or so uses logical mapping, and for the better part, employs 
the same logic as SCSI drives. (Some of IBM's models even include 
tagged command queueing.)

If your drive is not able to remap a bad sector from it's original spot 
to a spare sector, it usually has run out of spare sectors. It will 
only get worse from now on.

Normally, modern drives reserve some part of their raw capacity for 
spare sectors (the amount depends on the model, and cannot normally be 
seen easily). When the drive has trouble reading a certain sector, it 
will try to read the data multiple times. As soon as it manages to 
retrieve the data, it will mark the "physical" sector as bad 
internally, and transparently switch one of the spare sectors in it's 
place. This procedure is transparent to the host, apart from the delay 
while the drive's controller tries to recover the bad sector's 
contents. The controller can usually spot bad sectors before they 
become completly unreadable, because the sectors use ECC encodings, and 
the controller monitors the bit error rate while reading and writing.

In summary: your drive probably will only develop more and more bad 
sectors, until the file system structures will be affected. You better 
replace it while you have the chance. And you do have backups of 
everything, yes? :-)

As a historical note: BSD had some code to perform the same function 
(mark sectors as bad, and transparently map them to spare sectors). 
It's been a long time I messed with MFM/RLL drives; I think this was 
around 2.2 or so. I believe this functionality was nuked around 3.0 or 
so, but I might be mistaken.


Stefan Bethke <stefan.bethke at>
+49 170 346 0140

More information about the Ukfreebsd mailing list