Find the answer to your Linux question:
Results 1 to 3 of 3
Can anyone help? Iíve been Googling for days and canít find an answer : ( I need to disable Linux disk buffers/file cache. You will prob. want to know why ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2006
    Posts
    2

    Disable Linux Disk Buffers


    Can anyone help? Iíve been Googling for days and canít find an answer : (

    I need to disable Linux disk buffers/file cache.

    You will prob. want to know why I would want toÖ

    Iíve been setting up a diskless PC. This thing boots over the network PXE style using a RAM disk as root.

    I spent ages setting things up so that the OS and any software fits perfectly into 448MB (with a few MB left over for temp files etc). The system has 512MB RAM total, so this should leave 64MB to actually run the applications etc (should be plenty).

    Thing is, the disk buffer is eating up most/all of this 64MB and (of course?) since itís using RAM as root anyway, buffering is silly.

    (Iíve done some reading and understand that the disk buffer is supposed to resize itself so that it doesnít interfere with the apps memory allocation, but Iím guessing the buffering system thinks thereís plenty of RAM to play with (maybe not realising the 512MB is really only 64MB)).

    Not sure how relevant the distribution is in this case, but if it makes a difference. Itís Debian 3.1 with a 2.6.8 kernel (I recompiled the kernel and am not using any modules).

    Any help would be greatly appreciated. And if you can give me a quick fix like: append [diskbuffers=off], Iíll probably kiss you.

    Thanks in advance.

    Ps:

    Computers are what I do, but Iím very new to Linux.

  2. #2
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    I'm not sure if this will do the trick, but you can try mounting your root filesystem (and other filesystems) with the sync option. This bypasses the write-back cache so that all disk transactions happen in real-time.
    Stand up and be counted as a Linux user!

  3. #3
    Just Joined!
    Join Date
    Nov 2006
    Posts
    2
    I deleted my last message.

    The disk cache is limiting itself to a fraction of the available RAM (not the total). (Donít ask me whether itís supposed to or not).

    I did some more testing. Seems as though the ls ĖlR / thing slows down if thereís not enough RAM for the buffer (even when itís reading from RAM anyway).*


    This is now more of a matter of interest for me than an urgent problem, butÖ

    Can anyone tell me if a RAM disk root should need buffering? Also, is ext2 the best file system to use for a RAM disk?

    s'all v interesting : )


    *(Only way I was able to test it without disk buffer was to squash disk buffer out of the way with lots of apps, so it may not be a fair test).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •