Tracing Disk Access
Kenneth D. Merry
ken at kdm.org
Mon Nov 22 20:53:07 GMT 2004
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 at kdm.org
More information about the freebsd-hackers
mailing list