From owner-freebsd-questions Sat Apr 15 12:13:54 2000 Delivered-To: freebsd-questions@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 8599C37B61F for ; Sat, 15 Apr 2000 12:13:19 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from strontium.scientia.demon.co.uk ([192.168.91.36] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.12 #1) id 12gXzu-000Kei-00; Sat, 15 Apr 2000 20:12:50 +0100 Received: (from ben) by strontium.scientia.demon.co.uk (Exim 3.12 #7) id 12gXzu-0008TZ-00; Sat, 15 Apr 2000 20:12:50 +0100 Date: Sat, 15 Apr 2000 20:12:50 +0100 From: Ben Smithurst To: Scott Blachowicz Cc: freebsd-questions@freebsd.org Subject: Re: Erasing an IDE disk Message-ID: <20000415201250.A23900@strontium.scientia.demon.co.uk> References: <20000414161657.A35142@sabami.seaslug.org> <20000415165532.A16019@strontium.scientia.demon.co.uk> <20000415095209.A58006@sabami.seaslug.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20000415095209.A58006@sabami.seaslug.org> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Scott Blachowicz wrote: > What did you use to do that? And what OS version? FreeBSD 3.4, I think (definitely FreeBSD 3.something). I used this small program: #include #include #include #include #include #include #include #define DISK "/dev/wd1" int sig = 0; void nop(int s) { sig = 1; return; } int main(int argc, char *argv[]) { char buf[64 << 10]; int fd, ch, sverr; ssize_t n, tot; struct sigaction sa; sa.sa_handler = nop; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGINT, &sa, NULL); if (argc > 1) ch = strtol(argv[1], NULL, 0); else ch = 0xff; memset(buf, ch, sizeof buf); fd = open(DISK, O_WRONLY); if (fd < 0) err(1, DISK); warnx("ch=%x buf[0]=%x", ch, (unsigned int)buf[0]); tot = 0; while (!sig && (n = write(fd, buf, sizeof buf)) == sizeof buf) tot += n; sverr = errno; warnx("total %ld bytes written", (long)tot); if (sig) errx(1, "exiting because of signal"); errno = sverr; if (n < 0) err(1, "write"); else errx(1, "partial write of %ld bytes%s", (long)n, (n == 0) ? " (end of device?)" : ""); } Be sure to set the #define DISK correctly. :-) Then run it like ./diskerase 0x0 ./diskerase 0xff ./diskerase 0x0 #include Run at your own risk, etc. (I just mis-typed "risk" as "disk", which would probably be just as valid in this case. :-) -- Ben Smithurst / ben@scientia.demon.co.uk / PGP: 0x99392F7D To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message