It seem there are some problems with accessing HDD through GEOM: # egrep -v \^# /usr/local/etc/diskcheckd.conf /dev/ad0 * 28 * # diskcheckd # tail /var/log/messages ... Dec 2 12:46:50 vbook diskcheckd[1444]: DIOCGDINFO on /dev/ad0 failed: Operation not supported by device # strace /usr/local/sbin/diskcheckd -d ... open("/dev/ad0", O_RDONLY) = 3 ioctl(3, DIOCGDINFO, 0xbfbff250) = -1 ENODEV (Operation not supported by device) ... When I have change /dev/ad0 in config file to /dev/ad0s2c it work. But I want to check integrity of all drive, not only FreeBSD part. How-To-Repeat: Just run diskcheckd on post-GEOM CURRENT.
Hello Ben, Could you please have a look at this PR? Right now sysutils/diskcheckd is pretty much dead in the water. Edwin -- Edwin Groothuis edwin@freebsd.org http://www.mavetju.org
Edwin Groothuis wrote: > Could you please have a look at this PR? Right now sysutils/diskcheckd > is pretty much dead in the water. I'll look, but I really don't have much time for FreeBSD at the moment, unfortunately. :-( I didn't realize I was the maintainer of that port actually ... could you set it back to ports@ please? thanks, -ben -- Ben Smithurst / ben@FreeBSD.org FreeBSD: The Power To Serve http://www.FreeBSD.org/
On Mon, Sep 29, 2003 at 07:10:12AM -0700, Ben Smithurst wrote: > Cc: freebsd-gnats-submit@FreeBSD.org > Subject: Re: ports/45911 - sysutils/diskcheckd > Date: Mon, 29 Sep 2003 15:06:05 +0100 > > Edwin Groothuis wrote: > > > Could you please have a look at this PR? Right now sysutils/diskcheckd > > is pretty much dead in the water. > > I'll look, but I really don't have much time for FreeBSD at the moment, > unfortunately. :-( I didn't realize I was the maintainer of that port > actually ... could you set it back to ports@ please? You aren't the maintainer, you are the author of the original code. That's why I thought you might have a better chance of understanding what it is doing or what is going wrong. Edwin -- Edwin Groothuis | Personal website: http://www.mavetju.org edwin@mavetju.org | Weblog: http://www.mavetju.org/weblog/weblog.php
Edwin Groothuis wrote: >> I'll look, but I really don't have much time for FreeBSD at the moment, >> unfortunately. :-( I didn't realize I was the maintainer of that port >> actually ... could you set it back to ports@ please? > > You aren't the maintainer, you are the author of the original code. > > That's why I thought you might have a better chance of understanding > what it is doing or what is going wrong. It just looks to me like the rules for opening raw devices has changed in -current? I don't use -current so I can't easily play with this. sorry. -- Ben Smithurst / ben@FreeBSD.org FreeBSD: The Power To Serve http://www.FreeBSD.org/
State Changed From-To: open->suspended Mark suspended until someone submits patches, or volunteers to take over this port, or both. Note that since the port doesn't work on 5.X, it's in pretty bad shape. If no one steps forward, it should probably be marked as DEPRECATED and phased out.
Following patch makes it at least starting and successfully testing. I can't provide now bad disk to check error reporting;), but here only logging problem can appear, not functioning problem. diff -rNu 0/ports/sysutils/diskcheckd/files/diskcheckd.c 1/ports/sysutils/diskcheckd/files/diskcheckd.c --- 0/ports/sysutils/diskcheckd/files/diskcheckd.c Mon Oct 21 03:34:31 2002 +++ 1/ports/sysutils/diskcheckd/files/diskcheckd.c Tue Sep 21 18:59:13 2004 @@ -27,7 +27,7 @@ static const char rcsid[] = "$FreeBSD: ports/sysutils/diskcheckd/files/diskcheckd.c,v 1.6 2002/10/21 00:34:31 kris Exp $"; -#include <sys/types.h> +#include <sys/param.h> #include <sys/sysctl.h> #include <ctype.h> @@ -46,6 +46,7 @@ #define DKTYPENAMES #define FSTYPENAMES +#include <sys/disk.h> #include <sys/disklabel.h> #include <sys/diskmbr.h> @@ -757,7 +758,23 @@ void getdisksize(struct disk *dp) { struct disklabel label; +#if __FreeBSD_version >= 500040 + off_t mediasize; + u_int sectorsize; + if (ioctl(dp->fd, DIOCGSECTORSIZE, §orsize) < 0) { + syslog(LOG_NOTICE, "DIOCGSECTORSIZE on %s failed: %m", + dp->device); + exit(EXIT_FAILURE); + } + if (ioctl(dp->fd, DIOCGMEDIASIZE, &mediasize) < 0) { + syslog(LOG_NOTICE, "DIOCGMEDIASIZE on %s failed: %m", + dp->device); + exit(EXIT_FAILURE); + } + dp->secsize = sectorsize; + dp->size = mediasize; +#else if (ioctl(dp->fd, DIOCGDINFO, &label) < 0) { syslog(LOG_NOTICE, "DIOCGDINFO on %s failed: %m", dp->device); @@ -766,6 +783,7 @@ dp->secsize = label.d_secsize; dp->size = (off_t)label.d_secperunit * label.d_secsize; +#endif if (label.d_secsize != 512) syslog(LOG_NOTICE,
Resend previous patch with minor fix. This seems to be working and correctly reporting. Previous erroneosuly warned for incorrect sector size. (Note that code in logreaderror() is strictly bounded to DOS partitioning scheme and BSD labels in primary slices. This isn't too bad for now, but may confuse when using another schemes, e.g. GPT.) --- 0/ports/sysutils/diskcheckd/files/diskcheckd.c Mon Oct 21 03:34:31 2002 +++ 1/ports/sysutils/diskcheckd/files/diskcheckd.c Tue Sep 21 21:48:13 2004 @@ -27,7 +27,7 @@ static const char rcsid[] = "$FreeBSD: ports/sysutils/diskcheckd/files/diskcheckd.c,v 1.6 2002/10/21 00:34:31 kris Exp $"; -#include <sys/types.h> +#include <sys/param.h> #include <sys/sysctl.h> #include <ctype.h> @@ -46,6 +46,7 @@ #define DKTYPENAMES #define FSTYPENAMES +#include <sys/disk.h> #include <sys/disklabel.h> #include <sys/diskmbr.h> @@ -757,7 +758,23 @@ void getdisksize(struct disk *dp) { struct disklabel label; +#if __FreeBSD_version >= 500040 + off_t mediasize; + unsigned sectorsize; + if (ioctl(dp->fd, DIOCGSECTORSIZE, §orsize) < 0) { + syslog(LOG_NOTICE, "DIOCGSECTORSIZE on %s failed: %m", + dp->device); + exit(EXIT_FAILURE); + } + if (ioctl(dp->fd, DIOCGMEDIASIZE, &mediasize) < 0) { + syslog(LOG_NOTICE, "DIOCGMEDIASIZE on %s failed: %m", + dp->device); + exit(EXIT_FAILURE); + } + dp->secsize = label.d_secsize = sectorsize; + dp->size = mediasize; +#else if (ioctl(dp->fd, DIOCGDINFO, &label) < 0) { syslog(LOG_NOTICE, "DIOCGDINFO on %s failed: %m", dp->device); @@ -766,6 +783,7 @@ dp->secsize = label.d_secsize; dp->size = (off_t)label.d_secperunit * label.d_secsize; +#endif if (label.d_secsize != 512) syslog(LOG_NOTICE,
$ ls -l /usr/local/sbin/diskcheckd -r-xr-xr-x 1 root wheel 14860 Sep 28 02:13 /usr/local/sbin/diskcheckd* I'm running this on -CURRENT with your fix for a month. And finally I got an event we wanted to see(?): Oct 27 02:20:05 souffle kernel: ad0: TIMEOUT - READ_DMA retrying (2 retries left) LBA=738048 Oct 27 02:20:05 souffle kernel: ad0: FAILURE - READ_DMA timed out Oct 27 02:20:04 souffle diskcheckd[591]: error reading 65536 bytes from sector 738176 on /dev/ad0 Oct 27 02:20:05 souffle diskcheckd[591]: DIOCGDINFO on /dev/ad0s1 failed: Inappropriate ioctl for device Now the time for commit!
State Changed From-To: suspended->closed fixed by Valentin Nechayev.