LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 11-23-2011, 05:03 AM   #1
majormajor
LQ Newbie
 
Registered: May 2006
Posts: 5

Rep: Reputation: 0
disable disk cache


hi,
I saw some threads discussing how to clear the disk cache, but is it possible to configure the system not to use disk cache at all? How is that done?
Thanks.
 
Old 11-23-2011, 11:31 AM   #2
JonathanWilson
Member
 
Registered: Aug 2009
Location: Ilkeston, England
Distribution: ubuntu, xp, embeded
Posts: 79

Rep: Reputation: 1
I believe the command you are looking for is sdparm.

Be warned though its a very powerfull command and must be used with care, read the documentation fully before using.
 
Old 11-24-2011, 07:50 AM   #3
majormajor
LQ Newbie
 
Registered: May 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks Jonathan.

If I'm not mistaken this command addresses only SCSI devices. I am looking for a way to configure the system not to use cache at all (e.g. set the cache size to 0) that will work whatever memory I'm using (e.g. USB, RAM only).
 
Old 11-24-2011, 09:11 AM   #4
JonathanWilson
Member
 
Registered: Aug 2009
Location: Ilkeston, England
Distribution: ubuntu, xp, embeded
Posts: 79

Rep: Reputation: 1
Quote:
Originally Posted by majormajor View Post
Thanks Jonathan.

If I'm not mistaken this command addresses only SCSI devices. I am looking for a way to configure the system not to use cache at all (e.g. set the cache size to 0) that will work whatever memory I'm using (e.g. USB, RAM only).
Thats correct (although linux seems to denote all disks as scsi now, even if technically some should be hd*) so using sdparm should disable the write cache of the drives.

The following link, and its referenced links, may provide some insight to linux kernel cache as thats way beyond my knowledge.

http://www.westnet.com/~gsmith/conte...ux-pdflush.htm
 
Old 11-24-2011, 05:43 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
Quote:
Originally Posted by majormajor View Post
is it possible to configure the system not to use disk cache at all?
No (presuming you are talking about the page-cache).

Questions such as this generally indicate an insistence on a perceived answer - usually an incorrect one.
What is the problem you are trying to solve ? - the problem, not symptoms.
 
Old 11-26-2011, 04:03 AM   #6
majormajor
LQ Newbie
 
Registered: May 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you Jonathan. Thank you Syg00.

I am working on an embedded system that has no disk of its own, but may have USB inserted. so there are two problems I'm looking for answers:
1. I'm not sure what is the actual meaning of swapping when there is no disk at all
2. I want to test how much RAM I actually need for operation.
these two issues lead me to disabling the cache - at least for testing.
 
Old 11-26-2011, 04:48 AM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
Linux will work fine without swap at all - so long as you have sufficient memory (RAM). Swap is merely "overflow" for RAM.
Page-cache (what you see as cached in "free") is merely a convenient use for otherwise unused RAM. If otherwise needed (by userland applications) the page-cache is released. Automagically.
I suspect you are worrying unnecessarily.

Calculating how much memory your processes need is more "black art" than science. Even the kernel devs haven't pinned that one down satisfactorily. I'll get back to you with some suggestions - presuming you have a full set of tools available (/proc, /sys, perl ... that sort of thing).
 
Old 11-29-2011, 01:36 AM   #8
majormajor
LQ Newbie
 
Registered: May 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you very much. Looking forward for any "black art" suggestions :-)
 
Old 11-29-2011, 06:38 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
Rather than re-hash the old threads about how to account memory, go get ps_mem.py
Works the way I generally think it should, and the imbedded comments are informative background - as well as the python code itself of course.
 
Old 11-30-2011, 05:44 AM   #10
majormajor
LQ Newbie
 
Registered: May 2006
Posts: 5

Original Poster
Rep: Reputation: 0
I will dig into this script.
Thank you.
 
  


Reply



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 disable filesystem cache? nawwar Linux - Kernel 20 01-22-2016 03:49 AM
Disable Cache ?? Ameii83 Linux - Server 5 11-28-2006 08:12 PM
Ram wiht suse, cache Disk cache??? fadelhomsi Linux - Newbie 2 02-05-2006 11:29 PM
how-to disable cache squid paul_mat Linux - Networking 2 12-21-2005 11:32 PM
Is it possible to disable the disk cache? sunsfcn Linux - Software 3 07-15-2005 09:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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