linux - Is cached RAM in use or not?

24
2013-08
  • Seb

    I have these stats on my server at the moment:

    # free -mt
                 total       used       free     shared    buffers     cached
    Mem:         64461      64157        303          0         28      61563
    -/+ buffers/cache:       2565      61895
    Swap:         4999         35       4964
    Total:       69461      64192       5268
    

    am I running out of RAM and need to add more, as I only have 303Mb free, or am I okay because I have 61Gb cached and cached RAM that actually isn't in use or something?

  • Answers
  • mossy

    Cached RAM is not in use. This is normal - Linux is borrowing unused memory for disk caching. If your systems needs the RAM it will be available.

    To view how much free ram you have notice this row: -/+ buffers/cache: 61895

    Free represents your free RAM in MB.

    You are fine.


  • Related Question

    windows 7 - Possible to force all disk activity to RAM?
  • htalvitie

    I want to tell the operating system to stop using my hard disk and only use RAM as a cache instead.

    Optimally, I want to tell Windows to:

    a) pre-cache executable images and necessary bootstrap data into RAM, and b) buffer all disk writes to RAM.

    Is this possible?

    Background:

    My laptop hard disk is loud and I want to put it to sleep when I know I don't need it (e.g., "hdparm -Y").

    A typical use case would be booting Win 7 only to make a Remote Desktop Connection to a remote system, thus using the laptop only as a dumb terminal. There's no need to have the HD powered on, since everything's happening in memory, LAN etc.

    I have tried basically everything to shut down disk activity when the system is idle: killed nearly all processes, used Process Monitor in advanced mode to try to find which process is responsible for performing disk activity, but not succeeded.

    The closest I was able to reach my goal was with XP, when I installed a RAM overlay driver made by Microsoft and designed for Windows Embedded testing. That actually worked: all disk operations were intercepted and this prevented physical HD activity.

    Unfortunately, the WinCE RAM overlay driver was very hard to use and I managed to corrupt the disk at the end because the order in which I was supposed to unload and flush things was very particular. :-(

    I have now installed a RAM disk (RamDisk Plus) on my Win7 box and tried to install portable apps on it, but I don't think that even installing a user profile on the RAM disk, putting all temp files there etc. would be enough: There's some disk activity originating from the Windows kernel level, that ultimately wants to write to a physical disk thus waking up the hard drive.

    There are several other use cases for this need: keeping the system cool, running the laptop with less power, prolonging the lifespan of both physical and solide-state drives, etc.

    Suggestions?


  • Related Answers
  • quack quixote

    I don't believe you'll be able to accomplish this. Windows is designed around the concept that the system partition is always available, and your experiment with the RAM overlay shows it's not designed for what you have in mind.

    Instead, change the system partition. Use a non-hard-drive boot partition -- a LiveCD or USB key. You can certainly disable Windows access to non-system partitions, so moving the system partition off of hard drives will let you power down any attached hard drives.

    Update:
    After reviewing the materials on EWF, yes, this is possible.

    I still think this is a case of not-what-it's-designed-to-do, but...

    The EWF you used in WinXP came from Embedded XP. The Win-7 analogue is Windows Embedded Standard 2009, and does include the Enhanced Write Filter. I don't know if you'll be able to shoehorn EWF into Win-7, but you'll have better luck with the modern version than the old Embedded XP version.

    It looks like you want "EWF RAM Reg mode", which places your EWF configuration data in the system Registry, and doesn't require a separate partition on the drive. The other modes (EWF Disk and EWF RAM modes) at minimum require a separate partition to operate.

    You will want to review the techdoc on EWF Performance Considerations, particularly disabling last-access timestamps on NTFS, disabling System Restore, and changing the size of the pagefile (although it seems preferable to disable it, if possible).

    Consider designing your own run-time image as your OS base. By doing so you can eliminate components of Win-7 that may be problematic in an embedded, static configuration (which is essentially what you're describing). You may also want to use a checked build, if available, at least until you get things working as expected.

    Even this is, at best, educated guesswork. This method seems to be what a LiveCD uses to accomplish its magic, so you might have more luck looking into those. Even if a LiveCD is not your end-goal, the methods they use to build a system image may assist your endeavors. Best of luck!

  • progrmr

    If money is no object, you could replace the noisy HDD with an SSD. I have a MacBook with SSD and it is totally silent (and faster).

  • Simon

    Re your loud hard disk... have you tried turning on AAM (Automatic Acoustic Management) on the hard drive?

    http://en.wikipedia.org/wiki/Automatic%5Facoustic%5Fmanagement