How to set maximum disk cache size?

Bruce Cran bruce at
Thu Nov 15 12:43:54 PST 2007

Wojciech Puchar wrote:
 > Laszlo wrote:
>> Hi All,
>> Is there a way (sysctl?) to tell FreeBSD (6.2 RELEASE) how many memory 
>> can it use for caching file data from disk?
>> It might be that FreeBSD will use all available RAM, and reduce the cache 
> it already does

It may seem strange since it's generally accepted that you can never 
have enough disk cache, but FreeBSD apparently doesn't actually use all 
the free memory for caching.  By default it uses up to 256MB for 
buffering/caching and there's no way it can use all available memory on 
i386 in machines with more than 1GB installed since the buffer/cache is 
allocated from KVM and the default maximum is 1GB.  You can increase the 
amount of memory used, but it might not help - there's a thread on 
performance@ from 2004 which describes how it all works; see 

The information there is quite old now though so I don't know if things 
are done differently in 6.x.


More information about the freebsd-questions mailing list