Using SSD as Linux RAM

13,328

You can perform any operations you could perform with 164GB of RAM. But because the SSD is hundreds of times slower than RAM, it will take much longer.

You will want to turn the system's swappiness up so that you can use the faster SSD swap to effectively extend the size of the page cache. Otherwise, the system will assume swap and disk are about as fast and not move things into swap when it can read them from disk, which won't make sense in your unusual situation.

If you find you have a lot of disk I/O and very little swap being used, turn the swappiness up. If you find you're "churning" the SSD, turn the swappiness down. Note that this will have some minor negative effect on the life of your SSD -- the higher the swappiness, the more the effect. (With modern SSDs, it almost doesn't matter. There's no point in having an SSD if you don't use it.)

Share:
13,328

Related videos on Youtube

Hwong
Author by

Hwong

Updated on September 18, 2022

Comments

  • Hwong
    Hwong over 1 year

    I have a very very fast SSD OCZ Revo. I want to use a lot of RAM but I'm limited to 4GB RAM for the moment. If I use my SSD OCZ Revo as swap (the whole of it, 160GB), does that mean I have effectively 164GB RAM size total?

    My question is, how does linux treat swap? How can I use my SSD as RAM with the true RAM together? Anyone knows?

    • crea7or
      crea7or about 12 years
      Are you sure that you need such amount of RAM and this amount will be used effectively?
  • David Schwartz
    David Schwartz about 12 years
    Either the advice on that linked page is very old or simply incorrect. You could leave the SSD on a shelf to avoid degrading it or shortening its usable life too, but that would be kind of pointless. With modern SSDs, the effect on life is negligible compared to the loss of the potential benefits of actually using the SSD.
  • cutrightjm
    cutrightjm about 12 years
    Adding to this, SSDs only have a limited number of writes they can handle. Using a SSD as RAM would probably use a lot of these up more quickly, which would leave to the SSD dieng faster. If you can pump the money into a SSD, you can most likely buy some more RAM.
  • David Schwartz
    David Schwartz about 12 years
    This gets better every year. Here's one analysis from last year. But it definitely does mean SSDs would quickly wear out at write rates RAM can do, but that doesn't much matter since they're not capable of those speeds anyway.
  • cutrightjm
    cutrightjm about 12 years
    I must have some outdated information stored in my head =p And that article is almost a year old, so things have deinitely improved since then. Thanks for sharing that!
  • David Schwartz
    David Schwartz about 12 years
    This is another piece of information that will probably live for many, many years past its usefulness. It will join the advice not to charge your laptop battery constantly or to wait until it's fully discharged to begin charging it. (Advice that stopped applying to modern laptops about a decade ago.)
  • cutrightjm
    cutrightjm about 12 years
    I have still heard the 'not charge your laptop battery constantly', but that was something about how LiOn (I think it was LiOn) batteries shouldn't be charged past a certain percentage.. I hate it when I mix things up =p