Essentially my question is, does anyone know of a utility for inspecting the buffer cache in linux?
+1
A:
The linux kernel doesn't cache files, it caches blocks. A file may consist of many blocks, some of which may be cached and some which may not. What exactly are you trying to accomplish?
Robert Gamble
2008-10-17 01:28:50
lsof will tell you what processes have what files open, it doesn't tell you anything about the buffer cache.
Robert Gamble
2008-10-17 01:52:57
Don't be so sure. The man page is huge:-D DThis option directs lsof's use of the device cache file. The use of this option is sometimes restricted. See the DEVICE CACHE FILE section and the sections that follow it for more information on this option.
Leonardo Constantino
2008-10-17 01:54:28
I am very familiar with lsof and I know that it doesn't read the kernel's buffer cache. The device cache file that you mention is a regular file that lsof can create on systems that don't have /proc to speed up device file information lookups.
Robert Gamble
2008-10-17 02:07:54
A:
More detail on what you're trying to do might be helpful. As Robert mentioned, the buffer cache isn't file-oriented.
It probably wouldn't be hard to troll through /dev/kmem to extract the contents of the buffer cache, but why would you want to?
Mark Bessey
2008-10-17 01:54:02