Re: diskcheckd goes nuts on /dev/cd0

2001-07-08 Thread Joerg Wunsch

Bruce Evans <[EMAIL PROTECTED]> wrote:

> I think diskcheckd.conf should check no disks by default.

My opinion, too.  (After i suddenly noticed it checks anything by
default...)

>  Checking is bad for many types of disks.  It's bad for all disks on
> laptops running off batteries.

And for many other disks, it doesn't gain anything.  Except for
laptops, i generally don't buy ATA disks.  For a good SCSI disk,
disckcheck won't report anything.  It has the only side effect of
remapping a bad block, perhaps a bit earlier than it would have been
remapped during normal operation.  (If the disk really goes bad, it's
very likely that diskcheckd will be too late to detect it anyway.)  So
for me, diskcheckd could only be useful if it would also read out the
SCSI defect lists, and compare them on a daily basis so i get an early
warning about remap activity.

I'll add the knob to turn it off in sysinstall, which phk forgot to
add when he added it to rc.conf.

-- 
cheers, J"org   .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: diskcheckd goes nuts on /dev/cd0

2001-07-07 Thread Ben Smithurst

Dag-Erling Smorgrav wrote:

> Ben Smithurst <[EMAIL PROTECTED]> writes:
>> I was gonna commit a fix for this, but after reporting the problem DES
>> never tested the patch I supplied. :-(
> 
> I never got a patch.

Oh.  Well I'll leave you to figure out why the attached mail, which I
sent two weeks ago, didn't get to you then.

2001-06-23 20:26:28 15Dt36-000Kos-00 <= [EMAIL PROTECTED] 
H=strontium.shef.vinosystems.com [192.168.91.36] U=root P=esmtp S=4879 
[EMAIL PROTECTED] for [EMAIL PROTECTED] [EMAIL PROTECTED] 
[EMAIL PROTECTED]
2001-06-23 20:26:35 15Dt36-000Kos-00 => [EMAIL PROTECTED] R=lookuphost T=remote_smtp 
H=flood.ping.uio.no [129.240.78.31] C="250 VAA79059 Message accepted for delivery"

-- 
Ben Smithurst / [EMAIL PROTECTED]



ok, I think I agree with phk that excluding drives should be done in the
config file somehow, something like

!md
!acd
!cd

... hack hack hack ...

Could you test the attached patch?  It allows lines like the above in
diskcheckd.conf.  Seems to work but ref5 is the only current machine I
have access to which is a bit of a pain for testing things.

Stefan wrote...

>> 2) The defaults make diskcheckd read 4KB per transaction from my 
>>   system disk. I think I'd rather have it reading 64KB/t at a 
>>   rate of 1 per 16 seconds. (Perhaps 32KB is a better size, in
>>   order to not flush the drives cache, once per second ...)
>>
>>   Reading 16, 32 or 64KB at a time should (except for cache effects)
>>   cause minimally higher load per transaction than 4KB, and the 
>>   reduced transaction rate should drastically reduce the impact
>>   on the system.

This shouldn't be too hard to implement, I'll see what I can do.

-- 
Ben Smithurst / [EMAIL PROTECTED]


Index: diskcheckd.c
===
RCS file: /home/ncvs/src/usr.sbin/diskcheckd/diskcheckd.c,v
retrieving revision 1.1
diff -u -r1.1 diskcheckd.c
--- diskcheckd.c2001/06/03 20:02:03 1.1
+++ diskcheckd.c2001/06/23 19:18:37
@@ -62,7 +62,7 @@
 
 volatile sig_atomic_t got_sighup = 0, got_sigterm = 0;
 
-char **getdisknames(void);
+char **getdisknames(char **, int);
 off_t dseek(struct disk *, off_t, int);
 struct disk *readconf(const char *);
 void getdisksize(struct disk *);
@@ -464,6 +464,8 @@
double dval;
long lval;
int linenum;
+   char **skip;
+   int numskip;
 
if ((fp = fopen(conf_file, "r")) == NULL) {
syslog(LOG_NOTICE, "open %s failure: %m", conf_file);
@@ -482,6 +484,37 @@
line++;
if (*line == '#' || *line == '\n' || *line == '\0')
continue;
+
+   /* First, if the line starts with '!', this is a disk name
+* to ignore.  For example, '!md' will skip all '/dev/md*'
+* devices.
+*/
+   if (*line == '!') {
+   line++;
+   while (isspace(*line))
+   line++;
+   field = strsep(&line, " \t\n");
+   if (field == NULL || *field == '\0') {
+   syslog(LOG_NOTICE, "%s:%d: missing disk name",
+ conf_file, linenum);
+   continue;
+   }
+
+   numskip++;
+   if ((skip = reallocf(skip,
+ numskip * sizeof (*skip))) == NULL) {
+   syslog(LOG_NOTICE, "reallocf failure: %m");
+   exit(EXIT_FAILURE);
+   }
+
+   if ((skip[numskip-1] = strdup(field)) == NULL) {
+   syslog(LOG_NOTICE, "strdup failure: %m");
+   exit(EXIT_FAILURE);
+   }
+
+   continue;
+   }
+
fields = flags = 0;
while ((field = strsep(&line, " \t\n")) != NULL) {
if (*field == '\0')
@@ -602,7 +635,7 @@
onumdisks = numdisks;
for (dp = disks; dp < disks + onumdisks; dp++) {
if (strcmp(dp->device, "*") == 0) {
-   for (np = np0 = getdisknames(); *np != NULL; np++) {
+   for (np = np0 = getdisknames(skip, numskip); *np != NULL; 
+np++) {
odisks = disks;
if ((disks = reallocf(disks,
(numdisks + 1) * sizeof (*disks))) == NULL) {
@@ -746,10 +779,11 @@
  * is returned.
  */
 char **
-getdisknames(void) {
+getdisknames(char **skip, int numskip) {
char *string, *field;
size_t size, numdisks;
char **disks;
+   int i;
 
if (sysctlbyname("kern.disks", NULL, &size, NULL, 0) != 0 &&
errno != ENOMEM) {
@@ -768,6 +802,13 @@
disks = NULL;
numdisks = 0;
while ((

Re: diskcheckd goes nuts on /dev/cd0

2001-07-07 Thread Dag-Erling Smorgrav

Ben Smithurst <[EMAIL PROTECTED]> writes:
> I was gonna commit a fix for this, but after reporting the problem DES
> never tested the patch I supplied. :-(

I never got a patch.

DES
-- 
Dag-Erling Smorgrav - [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: diskcheckd goes nuts on /dev/cd0

2001-07-04 Thread Mark Valentine

> From: [EMAIL PROTECTED] (Ben Smithurst)
> Date: Wed 4 Jul, 2001
> Subject: Re: diskcheckd goes nuts on /dev/cd0

> I think excluding CDs and MDs should solve most of the problems that
> have been reported, I'm not sure what the situation with zip/jaz type
> things is though.  Are they included in kern.disks?  Anyone?

  kern.disks: md0 da2 da1 da0 cd1 cd0 ad0

  ad0: 73308MB  [148945/16/63] at ata0-master UDMA33
  da0:  Fixed Direct Access SCSI-3 device 
  da1:  Fixed Direct Access SCSI-3 device 
  cd1:  Removable CD-ROM SCSI-2 device 
  cd0:  Removable CD-ROM SCSI-2 device 
  da2:  Removable Direct Access SCSI-2 device 

da2 should not be checked.  ad0 is okay, it's not a flash device...

It's still unsafe to clean ad* or da* in the default disckcheckd.conf.

Cheers,

Mark.

-- 
Mark Valentine, Thuvia Labs <[EMAIL PROTECTED]>   <http://www.thuvia.co.uk>
"Tigers will do ANYTHING for a tuna fish sandwich."   Mark Valentine uses
"We're kind of stupid that way."   *munch* *munch*and endorses FreeBSD
  -- <http://www.calvinandhobbes.com>  <http://www.freebsd.org>

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: diskcheckd goes nuts on /dev/cd0

2001-07-04 Thread Antoine Beaupre (LMC)

Ben Smithurst wrote:

> Antoine Beaupre (LMC) wrote:
> 
> 
>>Actually, I think that it should exclude all devices except those 
>>specified in the config file... As in "check only requested disks"...
> 
> It's perfectly possible to do just that... 


good to hear that.

> phk wanted it to check all
> disks by default when I was writing it though, but this seems to be
> causing problems for people. :-(


Well, not only for people but mostly for hardware. ;)


> I think excluding CDs and MDs should solve most of the problems that
> have been reported, 


I think someone already raised the point about memory chips that "look 
like" IDE disks. These chips have limited r/w lifespan, and should be 
spared from diskcheck...

So that's another problem.

> I'm not sure what the situation with zip/jaz type
> things is though.  Are they included in kern.disks?  Anyone?


No idea. I could take a look at home when I buy my next power supply. ;)

A.

-- 
Antoine Beaupré
Jambala TCM team
Ericsson Canada inc.
mailto:[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: diskcheckd goes nuts on /dev/cd0

2001-07-04 Thread Ben Smithurst

Antoine Beaupre (LMC) wrote:

> Actually, I think that it should exclude all devices except those 
> 
> specified in the config file... As in "check only requested disks"...

It's perfectly possible to do just that... phk wanted it to check all
disks by default when I was writing it though, but this seems to be
causing problems for people. :-(

I think excluding CDs and MDs should solve most of the problems that
have been reported, I'm not sure what the situation with zip/jaz type
things is though.  Are they included in kern.disks?  Anyone?

-- 
Ben Smithurst / [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: diskcheckd goes nuts on /dev/cd0

2001-07-04 Thread Ben Smithurst

Steven G. Kargl wrote:

> Do you need to special case tape drives, floppies, zip, etc?  If so,
> you might want to exclude all devices except those that start with
> da and ad.

floppies, no:

ben@ref5:~$ grep fd0 /var/run/dmesg.boot 
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
ben@ref5:~$ sysctl kern.disks
kern.disks: ad0

i.e. floppies aren't included in kern.disks.

Not sure about zip disks, and if tapes are included in kern.disks
there's something very broken going on. ;-)

-- 
Ben Smithurst / [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: diskcheckd goes nuts on /dev/cd0

2001-07-04 Thread Antoine Beaupre (LMC)

Steven G. Kargl wrote:

> Ben Smithurst said:
> 
>>Steven G. Kargl wrote:
>>>As a side question, why is diskcheckd even looking at at /dev/cd0?
>>>
>>Because my only current system when I was writing diskcheckd didn't have
>>a CD drive so I didn't think to tell it not to check them.  Sorry...
>>
>>I'll commit a patch soon that allows you to specify drives to exclude,
>>and the default config file will exclude cd*, acd*, and md*.
> 
> Do you need to special case tape drives, floppies, zip, etc?  If so,
> you might want to exclude all devices except those that start with
> da and ad.


Actually, I think that it should exclude all devices except those 

specified in the config file... As in "check only requested disks"...


My 2 cents.


A.
-- 
Antoine Beaupré
Jambala TCM team
Ericsson Canada inc.
mailto:[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: diskcheckd goes nuts on /dev/cd0

2001-07-04 Thread Steven G. Kargl

Ben Smithurst said:
> Steven G. Kargl wrote:
> 
> > last message repeated 3 times
> > diskcheckd[213]: error reading 512 bytes from sector 0 on /dev/cd0
> 
> I was gonna commit a fix for this, but after reporting the problem DES
> never tested the patch I supplied. :-(
> 
> I'll commit it later hopefully; se@ did test it and it worked for him...

Ah, okay.  I checked GNATS and freebsd-current mailing list archive,
but I could not locate any relevant PR's or posts.

> 
> > As a side question, why is diskcheckd even looking at at /dev/cd0?
> 
> Because my only current system when I was writing diskcheckd didn't have
> a CD drive so I didn't think to tell it not to check them.  Sorry...
> 
> I'll commit a patch soon that allows you to specify drives to exclude,
> and the default config file will exclude cd*, acd*, and md*.
> 

Do you need to special case tape drives, floppies, zip, etc?  If so,
you might want to exclude all devices except those that start with
da and ad.

-- 
Steve
http://troutmask.apl.washington.edu/~kargl/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: diskcheckd goes nuts on /dev/cd0

2001-07-04 Thread Ben Smithurst

Steven G. Kargl wrote:

> I updated a pre june 13th current to a july 3 current.
> Ran mergemaster and installed /etc/diskcheckd.conf
> without modification.  Upon reboot I saw 1000s of the 
> following message streaming up the console:
> 
> dscheck(cd0): bio_bcount 512 is not on a sector boundary (ssize 2048)
> 
> Checking /var/log/messages I find (note date and machine name removed):
> 
> diskcheckd[213]: /dev/cd0 has 2048 byte sectors, may cause minor problems
> /boot/kernel/kernel: dscheck(cd0): bio_bcount 512 is not on a sector boun
> dary (ssize 2048)
> last message repeated 3 times
> diskcheckd[213]: error reading 512 bytes from sector 0 on /dev/cd0

I was gonna commit a fix for this, but after reporting the problem DES
never tested the patch I supplied. :-(

I'll commit it later hopefully; se@ did test it and it worked for him...

> As a side question, why is diskcheckd even looking at at /dev/cd0?

Because my only current system when I was writing diskcheckd didn't have
a CD drive so I didn't think to tell it not to check them.  Sorry...

I'll commit a patch soon that allows you to specify drives to exclude,
and the default config file will exclude cd*, acd*, and md*.

Also, you shouldn't get these errors soon even if diskcheckd did try to
check the CD drive, because it will no longer read in 512 byte blocks.

-- 
Ben Smithurst / [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: diskcheckd goes nuts on /dev/cd0

2001-07-04 Thread Mark Valentine

> From: [EMAIL PROTECTED] ("Steven G. Kargl")
> Date: Wed 4 Jul, 2001
> Subject: diskcheckd goes nuts on /dev/cd0

>  However, it seems that default
> settings in diskcheckd.conf that tell diskcheckd to check
> all kern.disks in system and setting diskcheckd_enable="YES"
> in /etc/defaults/rc.conf without a HEAD-UPS is somewhat
> alarming.

Yes, I thought this too.  Isn't this likely to do damage to some
types of media, for example Jaz disks which like to spin down most
of the time (and which aren't cheap)?

Also, it's pointless checking md devices...

What about stuff like flash RAM appearing as IDE disks?

> As a side question, why is diskcheckd even looking at
> at /dev/cd0?  From reading the man pages, one would infer
> that diskcheckd is intended to check for read errors on
> /dev/daYADA and /dev/adYADA and maybe /dev/fd0.

Just using kern.disks by default seems unwise.  Is there a way
to determine which devices are fixed magnetic disks?  (For SCSI?
IDE?  Other?)

I'd suggest that until this is resolved that the default diskcheckd.conf
not check anything; even just defaulting to ad0 probably isn't safe.

Cheers,

Mark.

-- 
Mark Valentine, Thuvia Labs <[EMAIL PROTECTED]>   <http://www.thuvia.co.uk>
"Tigers will do ANYTHING for a tuna fish sandwich."   Mark Valentine uses
"We're kind of stupid that way."   *munch* *munch*and endorses FreeBSD
  -- <http://www.calvinandhobbes.com>  <http://www.freebsd.org>

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



diskcheckd goes nuts on /dev/cd0

2001-07-03 Thread Steven G. Kargl

I'm sure this is pilot error, but ...

I updated a pre june 13th current to a july 3 current.
Ran mergemaster and installed /etc/diskcheckd.conf
without modification.  Upon reboot I saw 1000s of the 
following message streaming up the console:

dscheck(cd0): bio_bcount 512 is not on a sector boundary (ssize 2048)

Checking /var/log/messages I find (note date and machine name removed):

diskcheckd[213]: /dev/cd0 has 2048 byte sectors, may cause minor problems
/boot/kernel/kernel: dscheck(cd0): bio_bcount 512 is not on a sector boun
dary (ssize 2048)
last message repeated 3 times
diskcheckd[213]: error reading 512 bytes from sector 0 on /dev/cd0

Variations on the above 5 line fill that last 700 lines of
/var/log/messages.

I checked src/UPDATING for a diskcheckd HEADS_UP. Nada.

Read the diskcheckd and the diskcheckd.conf man pages. So,
I'll "fix" the problem.  However, it seems that default
settings in diskcheckd.conf that tell diskcheckd to check
all kern.disks in system and setting diskcheckd_enable="YES"
in /etc/defaults/rc.conf without a HEAD-UPS is somewhat
alarming.

As a side question, why is diskcheckd even looking at
at /dev/cd0?  From reading the man pages, one would infer
that diskcheckd is intended to check for read errors on
/dev/daYADA and /dev/adYADA and maybe /dev/fd0.

-- 
Steve
http://troutmask.apl.washington.edu/~kargl/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message