LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why should you give the size of the swap disk as twice the size of RAM (https://www.linuxquestions.org/questions/linux-newbie-8/why-should-you-give-the-size-of-the-swap-disk-as-twice-the-size-of-ram-231644/)

vmniza 09-17-2004 12:50 AM

Why should you give the size of the swap disk as twice the size of RAM
 
When you install Red Hat Linux, you are asked to give the size of your swap partition as twice the size of RAM. why is it so?

I read some where that you can use a fixed length file in a file system as a swap area. How do you specify it when you install Linux?

Bruce Hill 09-17-2004 01:04 AM

Welcome to LQ!

Quote:

Originally posted by vmniza
When you install Red Hat Linux, you are asked to give the size of your swap partition as twice the size of RAM. why is it so?
That was an old rule. What the kernel does is switch to virtual memory
(swap partition) when you run out of physical memory. How much swap
you need depends upon your amount of ram and applications. My comp
has 1GB of ram, and I use apps like The GIMP and Scribus which do require
a lot of memory, as well as having Mozilla Firefox, KMail, several xterms,
xmms, and other apps running at the same time. To my knowledge, even
with GIMP working on a 75MB file, I've never gone over my 1GB of memory
and into swap. Still, I make a 1GB swap partition. This really depends upon
what you use your comp for, and how much physical memory you have.
Quote:

I read some where that you can use a fixed length file in a file system as a swap area. How do you specify it when you install Linux?
Don't know that I've ever read that. Can you post a link?

btmiller 09-17-2004 01:35 AM

I don't know how to make a swap file on install, but it's easy to set it up on the first boot. Something like,

dd if=/dev/zero of=/swap/file bs=512 count=<# of 512 byte blocks in the swapfile>
chown root:root /swap/file
chmod 600 /swap/file # it's bad if non-root folks can read swap space
mkswap /swap/file
swapon /swap/file

And then add it to your fstab to enable it on subsequent reboots.

amosf 09-17-2004 02:13 AM

You want a swap file/partition as big as you need :)

Depends on what you do. I currently have a gig swap on my 256meg box as I was running low at times and had heaps of drive space...

Not upgrading ram as I'm going to upgrade the MD/CPU shortly anyway...


All times are GMT -5. The time now is 08:57 AM.