Subject: Re: wd(4) questions
To: Dieter <netbsd@sopwith.solgatos.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-help
Date: 08/20/2005 14:06:01
On Fri, Aug 19, 2005 at 02:21:45PM +0100, Dieter wrote:
> > > Is there a way to get wd(4) to upgrade the mode back without rebooting?
> > > I don't see anything in wd(4) or atactl(8) man pages.
> > 
> > Not yet. It's still on my todo list but at very low priority ...
> 
> I was thinking... I'm guessing this speed downgrade is inherited from
> PATA, where the unterminated cable is said to be marginal at best,
> and running it at lower speed will likely work better.  Is reducing
> the speed on a SATA connection actually likely to work any better?

The problem is that we don't know what kind of interface we have:
if could be a PATA drive behind a SATA/PATA bridge (or, with a PATA
controller, we could also have a SATA drive behind a bridge).
In such a case, the bridge should snoop the SET_FEATURE command and
change its speed appropriately.

> 
> > > Question 2:
> > > 
> > > dd if=/dev/zero of=/dev/rwd0c count=161507 bs=1512k
> > > 
> > > dd: /dev/rwd0c: Input/output error
> > > 160466+0 records in
> > > 160465+0 records out
> > > 248446033920 bytes transferred in 37890.490 secs (6556949 bytes/sec)
> > > 
> > > I was expecting to see a disk write error logged in /var/log/messages,
> > > but there is nothing?
> > 
> > Maybe it was missed by syslog, but it's present in dmesg output ?
> > Also, if you're hitting the end of the disk, it's possible that the error was
> > reported by bounds_check_with_mediasize(), in which case no message is
> > printed.
> 
> I don't see any write errors in dmesg either. (see below)
> 
> It is not hitting the end of the disk, it still has 1613316096 bytes
> (1042 1512k blocks) to go.  I set up the oddball count and bs arguments
> to be exactly the size of the disk (from disklabel, below) to avoid
> having dd smack into the end of the disk and generate an error message.
> (I've gotten error messages from hitting the end of the drive before,
> although that might have been with the sd driver rather than wd.)
> 
> "atactl wd0 identify" says:
> Cylinders: 16383, heads: 16, sec/track: 63, total sectors: 268435455
> 
> I don't know where atactl is getting these numbers, but 268435455 sectors
> is wrong.  That's only 137 GB.  atactl reports the same numbers for both drives.
> Hmmm, could atactl's "total sectors" be per platter?  I think these drives are
> supposed to have 133 GB per platter.

No, it's most likely that 2.0.2 atactl doesn't handle LBA48 properly.

> 
> Also, if I set the skip argument to dd I can read sectors beyond the
> bad section without errors.
> 
> The other odd thing is I was expecting the drive to substitute spare sectors
> when writing to it and thus fix the bad spot.  It should have something like
> 16-25 GB of spare sectors.

OK, I know what this is. There is a list of bad sector maintained by the
wd driver, to return error without requesting an I/O to the drive (to avoid
downgrades, and long hangs when trying to read a bad sector).
The code doens't make a difference between read and write
(while a write would likely remap the bad sector). You can use
'dkctl badsector' to see or flush this list. 
A dkctl badsector flush followed by a write to this sector should fix it.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--