Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-14-2007, 11:29 AM   #1
LQ Newbie
Registered: Nov 2005
Posts: 8

Rep: Reputation: 0
Flush file system cache?

How do you get linux to flush its file system cache?

I need to get the file system cache flushed (or at least one file that I know is cached) to produce repeatable consistent performance testing results.

Old 03-14-2007, 12:03 PM   #2
Registered: Sep 2006
Distribution: Windows .. MUAHAHAHA
Posts: 66

Rep: Reputation: 15
This works for SLES10 and RHEL5 I believe /proc/sys/vm/drop_caches
Old 03-14-2007, 12:30 PM   #3
Senior Member
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,195

Rep: Reputation: 265Reputation: 265Reputation: 265
Also the command "sync" will write it to disk. The C function "fsync" can be used to write one specific file.
Old 03-14-2007, 12:34 PM   #4
LQ Newbie
Registered: Jul 2004
Posts: 23

Rep: Reputation: 15
/proc/sys/vm/drop_caches for fedora core 6

<edit>I just remember i needed and option to mount a FS but preventing it from beeing cached by the kernel - oracle... - Unfortunatly there's no option for it until RHEL 5 but its already present in fedora core 6

From mount man page:

nobh Do not attach buffer_heads to file pagecache


Hope it helps

Last edited by RomKnight; 03-14-2007 at 12:41 PM.
Old 03-14-2007, 02:04 PM   #5
LQ Newbie
Registered: Nov 2005
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks all...
Since I'm running 2.6.13 the drop_caches is not available... sigh..

I'll be upgrading.
Old 03-14-2007, 02:17 PM   #6
Senior Member
Registered: Nov 2006
Distribution: Debian Squeeze SMP AMD64
Posts: 3,255

Rep: Reputation: 125Reputation: 125
I don't know what kind of testing you're trying to do, but just flushing the cache may not be enough to get the results you want. To totally eliminate the effects of caching you will need to do a complete memory flush: i.e. read or write data that is larger than system memory.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how-to flush dns cache PlatinumRik Linux - Networking 6 07-27-2011 02:47 PM
Display and Flush DNS cache click Linux - Networking 7 11-10-2009 01:00 PM
How can I turn off File system cache? joxer77 AIX 4 08-04-2005 09:10 AM
how to reload sbp2 module /Flush terminal command cache Lakota Mandriva 1 12-07-2004 02:08 PM
File system cache in Redhat Linux svyshna Linux - General 1 09-06-2003 10:18 PM

All times are GMT -5. The time now is 02:31 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration