Command to flush file system cache to prepare for performance testing?

Martin Olsson mnemo at
Tue Dec 9 22:39:31 UTC 2008


If grep through all files in a directory twice, then the first time takes
a lot longer because the second run will have most of the files available
in the "in memory file system cache".

I want to do some basic performance testing for a scenario involving disk I/O.
I'm wondering if there is a command to purge the file system cache, either
for a specific directory or file (which would be great) or otherwise purge the
whole thing.

Basically, to create repeatable perf tests and get consistent results I would
like to pin down all the "system state" so that any changes in numbers will
be directly attributable to my code changes.

Does anyone know such a command to flush the file system cache?


More information about the Ubuntu-devel-discuss mailing list