From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 22 20:53:06 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DD18916A4CE for ; Mon, 22 Nov 2004 20:53:06 +0000 (GMT) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.FreeBSD.org (Postfix) with ESMTP id 75EFF43D5C for ; Mon, 22 Nov 2004 20:53:06 +0000 (GMT) (envelope-from ken@nargothrond.kdm.org) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.12.11/8.12.11) with ESMTP id iAMKr58w076765 for ; Mon, 22 Nov 2004 13:53:05 -0700 (MST) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.12.11/8.12.5/Submit) id iAMKr575076764 for freebsd-hackers@freebsd.org; Mon, 22 Nov 2004 13:53:05 -0700 (MST) (envelope-from ken) Date: Mon, 22 Nov 2004 13:53:05 -0700 From: "Kenneth D. Merry" To: freebsd-hackers@freebsd.org Message-ID: <20041122205305.GA76707@nargothrond.kdm.org> References: <20041122152254.GA1229@gicco.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041122152254.GA1229@gicco.homeip.net> User-Agent: Mutt/1.4.2i X-Virus-Scanned: clamd / ClamAV version 0.75.1, clamav-milter version 0.75c on nargothrond.kdm.org X-Virus-Status: Clean X-Mailman-Approved-At: Tue, 23 Nov 2004 13:31:56 +0000 Subject: Re: Tracing Disk Access X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2004 20:53:07 -0000 On Mon, Nov 22, 2004 at 16:22:54 +0100, Hanspeter Roth wrote: > > Hello, > > I have set an idle timeout for the hard-disk. But when there is no > user activity there are frequent disk accesses. > How can one trace disk access? > I'd like to know the kind of access and on which files/directories/ > nodes. I'd like to log on the console or on a memory disk file. Well, this isn't quite what you want, but if you have a SCSI disk you can use the CAM debug facility to see what's going on. Compile your kernel with the CAMDEBUG option. Then run 'camcontrol debug -Ic bus:target:lun' where the bus, target and LUN are the numbers displayed by 'camcontrol devlist'. You'll see more console output than you care to see. (It'll printout the CDB for each command that goes down to that particular device.) If this disk contains /var/log, you'll get into an interesting loop because each console printf will cause syslog to write to the disk, which will in turn cause another console printf. Type 'camcontrol debug off' to turn it off. Ken -- Kenneth Merry ken@kdm.org