Results 1 to 10 of 15

Thread: How does the 'swap' drive actually work????

Hybrid View

  1. #1
    Join Date
    Apr 2008

    How does the 'swap' drive actually work????

    I was wondering about the Linux swap partition drive.

    So, it uses hard drive space as memory. Does this mean that if I had a 100GB hard drive and used 90GB for swap, that this computer will run decently fast???

  2. #2
    Join Date
    Mar 2005
    Ubuntu 9.04 Jaunty Jackalope

    Re: How does the 'swap' drive actually work????

    It only uses it as a last resort, because hard drives are _much_ slower than actual memory. I notice a pretty big slowdown if/when my computer starts using the swap. Most of the time it doesn't need it though.
    100 buckets of bits on the bus,
    100 buckets of bits,
    Take one down, short it to ground,
    FF buckets of bits on the bus.

  3. #3
    Join Date
    Feb 2008

    Re: How does the 'swap' drive actually work????

    your Swap drive only needs to be twice as (or 2.5x) the physical RAM in your box.

    i.e. if your box had 2Gb of RAM then the swap partition should be 4Gb or 5Gb in size. Anything bigger would not improve performance.
    Last edited by solitaire; May 5th, 2008 at 10:58 PM. Reason: updated the sizes should be 2x not 1x
    "Have you found the secrets of the universe? Asked Zebade "I'm sure I left them here somewhere" User numbers: Ubuntu 23772 Linux 477911

  4. #4
    Join Date
    Dec 2006
    Hardy Heron (Ubuntu Development)

    Re: How does the 'swap' drive actually work????

    I've got 2 GB of RAM in my MPB, and I'm not even using a swap, and I never seem to have any problems.

    When the swap partition/file was invented, 2MB of ram was unthinkable. I think it made alot more sense then. But RAM is cheap.

    Really, you DON'T want your computer using the swap file if you can help it. I've always heard it's good to use a swap file/partition as BIG as your ram, not 2.5 times. I can't understand why you'd need that much space dedicated for 2.5 times Ram, Although I could be wrong.

    Macbook Pro C2D
    Ubuntu 8.04

  5. #5
    Join Date
    Nov 2006
    Ubuntu 13.10 Saucy Salamander

    Re: How does the 'swap' drive actually work????

  6. #6
    Join Date
    Apr 2008
    Kubuntu 11.04 Natty Narwhal

    Re: How does the 'swap' drive actually work????

    I got a question related to that as well.

    I never fully understood the need of a SWAP partition. It's needed when there is not enough RAM available. OK, I understand that. But what else is it really doing?
    I checked a server in the office the other day that used (at the end of the day) around 250-300MB RAM, no SWAP was used so far. The next morning RAM usage didn't change but a few MB SWAP was used. The system has 4GB RAM. Why was the SWAP used with still tons of RAM available?

    Another question that I have is what happens when I suspend to disk. Is the SWAP partition used to save the data from the RAM? If so, what if there is not enough space available for RAM + potential SWAP usage?
    If not, where is the data saved to?

    Which then also leads me to the question, how can SWAP increase the performance of systems that has plenty of RAM (2GB+). Assuming that it's not a computer that is used for RAM intensive work like video editing, etc. I would guess that someone doing that has "enough" RAM according to his needs, anyways.
    So, with enough RAM, why wouldn't it be enough to have rather little SWAP, e.g. 300MB?

    The last question that bugs me since a while is, since HDD's are rather slow, would it be possible to use a USB FlashDrive as SWAP partition? Would that increase the performance?


Posting Permissions

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