I take debugging advice from the Rolling Stones.
Linux, like Unix, gives you this information as a file's "atime" (access time). I do ls -ulrt several times a week -- often several times a day -- to find out what files were used most recently.
Think of "-u" as the "useful" flag.
Here's an example experiment:
$ echo hello > fooNote that ls -l says when the file was created, but ls -ul matches the output of date.
$ sleep 120; cat foo; date; ls -l foo; ls -ul foo
$ sleep 120; cat foo; date; ls -l foo; ls -ul foo
Executing a command requires the system read it, so that, too, updates the command's atime.
I find things being used in a subtree like this:
$ touch /tmp/sentinelWhen I was trying to find out which files were read by kickstart, I just ran kickstart and did an ls -ulrt on my kickstart server ... and found out that Fedora-8 has broken atime.
# do some stuff
$ find . -anewer /tmp/sentinel
It's added a real-time hack, relatime (relative atime), in which the *first* ls -ul works, but later ones don't. This gives better performance on running systems, but takes away a traditional, and handy, debugging tool.
Aargh.
Reading documentation, Googling, and begging for help on the BLUG mailing list all failed. Finally, Kevin Fenzi cheerily gave me the solution:
$ sudo bash -c 'echo 0 > /proc/sys/fs/default_relatime'Nice. Thanks Kevin.
$ sudo mount -o remount,atime /
How did Kevin figure it out? He read the kernel code.
No comments:
Post a Comment