| From | Sent On | Attachments |
|---|---|---|
| Rick Hamell | Sep 19, 2000 5:35 am | |
| Rick Hamell | Sep 19, 2000 8:42 am | |
| Alfred Perlstein | Sep 20, 2000 12:51 pm | |
| Edward Elhauge | Sep 20, 2000 12:58 pm | |
| Wilko Bulte | Sep 20, 2000 12:59 pm | |
| Marc Tardif | Sep 20, 2000 1:08 pm | |
| Wilko Bulte | Sep 20, 2000 1:18 pm | |
| David Scheidt | Sep 20, 2000 1:20 pm | |
| Alfred Perlstein | Sep 20, 2000 1:23 pm | |
| Edward Elhauge | Sep 20, 2000 1:24 pm | |
| Fred Clift | Sep 20, 2000 1:34 pm | |
| Bernd Walter | Sep 20, 2000 1:43 pm | |
| Alfred Perlstein | Sep 20, 2000 1:47 pm | |
| Nick Rogness | Sep 20, 2000 1:48 pm | |
| Matthew Jacob | Sep 20, 2000 1:55 pm | |
| Bernd Walter | Sep 20, 2000 2:26 pm | |
| Aleksandr A.Babaylov | Sep 20, 2000 2:55 pm | |
| Warner Losh | Sep 20, 2000 3:01 pm | |
| Warner Losh | Sep 20, 2000 3:02 pm | |
| David Scheidt | Sep 20, 2000 3:28 pm | |
| Aleksandr A.Babaylov | Sep 20, 2000 3:50 pm | |
| Sergey Babkin | Sep 20, 2000 5:47 pm | |
| Mike | Sep 20, 2000 6:09 pm | |
| David Scheidt | Sep 20, 2000 6:50 pm | |
| Aleksandr A.Babaylov | Sep 20, 2000 8:58 pm | |
| Keith Kemp | Sep 21, 2000 3:28 pm | |
| Douglas Swarin | Sep 21, 2000 4:23 pm | |
| Warner Losh | Sep 21, 2000 4:44 pm | |
| Sergey Babkin | Sep 21, 2000 5:08 pm | |
| Joe Greco | Sep 21, 2000 7:32 pm | |
| Joe Greco | Sep 21, 2000 7:37 pm | |
| Douglas Swarin | Sep 21, 2000 10:26 pm | |
| jdb-...@layer8.net | Sep 21, 2000 11:55 pm | |
| Adrian Chadd | Sep 22, 2000 7:23 am | |
| Wes Peters | Sep 22, 2000 10:41 pm | |
| Warner Losh | Sep 23, 2000 8:21 am | |
| Andreas Klemm | Oct 3, 2000 11:18 am |
| Subject: | Re: Frustration with SCSI system | |
|---|---|---|
| From: | Joe Greco (jgr...@ns.sol.net) | |
| Date: | Sep 21, 2000 7:37:24 pm | |
| List: | org.freebsd.freebsd-hackers | |
Whoops, sorry about the previous misfire...
In message <2000...@ns2.uncanny.net> Edward Elhauge writes: : to autorecover on bad sectors, but every system that I've had to recover : seems to be in a state where the bad sectors aren't remapping. I've tried
I've often wanted to write a bad block remapper. While SCSI is supposed to do this automatically, I've found that a scan on any adaptec controller will remap these blocks (forces the remapping).
I've got a program which attempts to read all blocks and may be able to rewrite bad blocks. It's nothing fancy. Only works if you've got auto-reallocate turned on in the drive.
% cat diskscan.c #include <stdio.h> #include <unistd.h> #include <errno.h> #include <fcntl.h>
int fixup(off, fd) off_t off; int fd; { char buffer[512]; int i, rval;
for (i = 0; i < 65536; i += 512) { if (lseek(fd, off + i, SEEK_SET) < 0) { doerror("lseek", off + i, 0); } if ((rval = read(fd, buffer, sizeof(buffer))) != sizeof(buffer)) { if (errno) { if (lseek(fd, off + i, SEEK_SET) < 0) { doerror("lseek", off + i, 0); } write(fd, buffer, sizeof(buffer)); } } } }
int doerror(str, off, type) char *str; off_t off; int type; { static int ign = 0; char buffer[80];
fprintf(stderr, "\nError at %qx, ", (quad_t) off); perror(str); if (! ign) { if (type) { fprintf(stderr, "Attempt to correct? (y/n/a) "); } else { fprintf(stderr, "Press 'y' to continue: "); } while (! ign) { fgets(buffer, sizeof(buffer), stdin); if (*buffer == 'y') { return(0); } if (*buffer == 'n') { return(1); } if (*buffer == 'a') { ign++; return(0); } } } return(0); }
int main(argc, argv) int argc; char *argv[]; { int fd, rval; char buffer[65536]; off_t off = 0; int eof = 0; int count = 0;
if (argc != 2) { fprintf(stderr, "usage: diskscan <dev>\n"); exit(1); } if ((fd = open(argv[1], O_RDWR, 0644)) < 0) { perror(argv[1]); } while (! eof) { if (! count) { fprintf(stderr, "%qx, ", (quad_t) off); } count++; count %= 8;
if (lseek(fd, off, SEEK_SET) < 0) { doerror("lseek", off, 0); } if ((rval = read(fd, buffer, sizeof(buffer))) != sizeof(buffer)) { if (errno) { if (! doerror("read", off, 1)) { fixup(off, fd); } } } off += sizeof(buffer); } }
I don't even guarantee that it's correct, but I do use it with some success... vinum takes an entire drive offline when it sees an error, and I use this to scan for and fix errors before turning the drive back on.
-- ... Joe
------------------------------------------------------------------------------- Joe Greco - Systems Administrator jgr...@ns.sol.net Solaria Public Access UNIX - Milwaukee, WI 414/342-4847
To Unsubscribe: send mail to majo...@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message





