Subject: Re: wd(4) questions
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Dieter <netbsd@sopwith.solgatos.com>
List: netbsd-help
Date: 08/20/2005 12:54:02
> > > > 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.

Yeah, the bridge issue came to mind *after* I had sent the message.

Perhaps a "don't downgrade speed due to error" flag in the config file,
similar to the "use a lower speed than the device & controller claim" flags?
Or an option to atactl or dkctl?

For PATA drives, having the default be to lower the speed makes sense,
but it would be nice to have an option to lock the speed for cases where
you know the errors are from the disk and not from the cable.

> > 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).

I suspected this when trying to recover my scrambled PATA drive.

> 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.

The badsector option looks very useful, thank you!

Is there a way to get the disk's list of bad sectors?  I have vague memories
of being able to do this back in the ST-506 days.

Meanwhile, the other new drive (same make and model, shipped in the same box,
intended to become a RAID1 mirror) is looking okay so far:

dd if=/dev/rwd0c count=161507 bs=1512k of=/dev/null
161507+0 records in
161507+0 records out
250059350016 bytes transferred in 6657.544 secs (37560300 bytes/sec)

dd if=/dev/zero of=/dev/rwd0c count=161507 bs=1512k
161507+0 records in
161507+0 records out
250059350016 bytes transferred in 38300.036 secs (6528958 bytes/sec)

I was expecting write to be slower than read, but not this much slower.
Is this typical, or do I have something wierd going on?

Would NCQ help on sequential writes?  The controller and disk both claim
NCQ support, but I haven't found anything in NetBSD sources that looks
like NCQ support (maybe I missed it?).