Re: Tracing Disk Access

2004-11-23 Thread Robert Watson

On Tue, 23 Nov 2004, Andrey Simonenko wrote:

> On Mon, Nov 22, 2004 at 06:33:18PM -0500, Brian Fundakowski Feldman wrote:
> > On Mon, Nov 22, 2004 at 04:22:54PM +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.
> > 
> > You should look to the MAC framework to provide you -- if not the entire
> > solution -- at least insight into how and where you can do this.  If you
> > were to do it at the disk device level, it would be a GEOM module, though.
> 
> As I understood you suggested to insert controlling geom between a
> consumer and a provider attached to each other.  Am I right that with
> GEOM framework it is impossible to control if some data is read from the
> buffer cache and it is only possible to control device strategy calls? 

That is correct: GEOM only sees the disk I/O events against storage
devices below the abstraction of the buffer cache, which is a service
"library" in the file system/VM.  So you will only see "real" I/O, not the
list of desired disk blocks required by the file system.  In 6.x, the file
systems actually talk directly to GEOM; in 5.x, file systems take a detour
through specfs, which services device vnodes as part of devfs.  In 4.x,
specfs vnodes may be in any file system.

Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
[EMAIL PROTECTED]  Principal Research Scientist, McAfee Research


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Tracing Disk Access

2004-11-23 Thread Robert Watson

On Mon, 22 Nov 2004, Brian Fundakowski Feldman wrote:

> > 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.
> 
> You should look to the MAC framework to provide you -- if not the entire
> solution -- at least insight into how and where you can do this.  If you
> were to do it at the disk device level, it would be a GEOM module,
> though. 

I recently added KTR tracing to geom_io.c which allows a trace of I/O
events both as they go up and down the GEOM stack, and as they're handed
off to disks, etc, so that should help provide detailed tracing of the
actual disk I/O's. 

For files/directories, hopefully we'll be ready to start merging some of
the Audit changes from the TrustedBSD branches to CVS in the next few
months, which will also provide a useful tracing mechanism at the higher
levels of the kernel. 

Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
[EMAIL PROTECTED]  Principal Research Scientist, McAfee Research

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Tracing Disk Access

2004-11-23 Thread Andrey Simonenko
On Mon, Nov 22, 2004 at 06:33:18PM -0500, Brian Fundakowski Feldman wrote:
> On Mon, Nov 22, 2004 at 04:22:54PM +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.
> 
> You should look to the MAC framework to provide you -- if not the entire
> solution -- at least insight into how and where you can do this.  If you
> were to do it at the disk device level, it would be a GEOM module, though.
> 

As I understood you suggested to insert controlling geom between a
consumer and a provider attached to each other.  Am I right that with
GEOM framework it is impossible to control if some data is read from
the buffer cache and it is only possible to control device strategy
calls?
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Tracing Disk Access

2004-11-23 Thread Kenneth D. Merry
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
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Tracing Disk Access

2004-11-22 Thread Brian Fundakowski Feldman
On Mon, Nov 22, 2004 at 04:22:54PM +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.

You should look to the MAC framework to provide you -- if not the entire
solution -- at least insight into how and where you can do this.  If you
were to do it at the disk device level, it would be a GEOM module, though.

-- 
Brian Fundakowski Feldman   \'[ FreeBSD ]''\
  <> [EMAIL PROTECTED]   \  The Power to Serve! \
 Opinions expressed are my own.   \,,\
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Tracing Disk Access

2004-11-22 Thread Hanspeter Roth

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.

-Hanspeter
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"