From owner-freebsd-questions@FreeBSD.ORG Fri May 16 07:27:57 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D898B37B404 for ; Fri, 16 May 2003 07:27:57 -0700 (PDT) Received: from letos.cs.uh.edu (letos.cs.uh.edu [129.7.240.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E10043F75 for ; Fri, 16 May 2003 07:27:56 -0700 (PDT) (envelope-from pdesai1@cs.uh.edu) Received: from themis.cs.uh.edu (themis [129.7.240.5]) by letos.cs.uh.edu (8.12.9/8.12.8) with ESMTP id h4GERmDJ017927; Fri, 16 May 2003 09:27:48 -0500 (CDT) Received: from localhost (pdesai1@localhost) by themis.cs.uh.edu (8.11.6+Sun/8.11.4) with ESMTP id h4GERm019019; Fri, 16 May 2003 09:27:48 -0500 (CDT) X-Authentication-Warning: themis.cs.uh.edu: pdesai1 owned process doing -bs Date: Fri, 16 May 2003 09:27:47 -0500 (CDT) From: "Pranav A. Desai" To: Andy Farkas In-Reply-To: <20030516092757.A77647-100000@hewey.af.speednet.com.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: questions@freebsd.org Subject: Re: How to detect hard disk failure ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 May 2003 14:27:58 -0000 Hi! We deal with proxy caches and in my experience when there is a disk failure the system becomes dead in a few seconds because of the heavy disk usage. So we probably wont be able to do an entire disk scan (36G or more). I looked at some libdisk functions (Open_Disk() etc.) and they do seem to open and write to disks, which will indicate whether a disk is usable or not. We need to do it as a periodic task, so I am not sure if this will affect the performance or whether it will even work. The other thing that I thought of doing is to capture /var/log/messages for any errors regarding disks. But I have two problems with that. 1) I dont know how to do tail -f in shell script. 2) I am not sure if messages gives all kinds of disk errors. any thoughts... thanks -pranav ******************************************************************* Pranav A. Desai On Fri, 16 May 2003, Andy Farkas wrote: > On 15 May 2003, Lowell Gilbert wrote: > > > > Is there a way to detect hard disk failures using either a shell script > > > or C program ? So that I can take appropriate action in case of a hard > > > disk failure. > > > > You can keep watch the logs for errors accessing the disks... > > You can do a "dd if=/dev/ad0 of=/dev/null bs=64k" to read the entire disk > surface - if there are bad blocks, read errors will show up on the > console. > > -- > > :{ andyf@speednet.com.au > > Andy Farkas > System Administrator > Speednet Communications > http://www.speednet.com.au/ > > >