SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
When I first started with linux the rule of thumb
for creating a swap partition was to set it to about
twice the size of the RAM. It made sense when you had
less than 256MB of RAM.
My previous computer had 2GB and I choose 2GB for my swap
and the laptop I'm using now has 4GB and so is the swap
I set up
Whenever I type in:
# free
I notice that the swap is never used as I have still
plenty of RAM available
so I'm just wondering is it really necessary to have
a swap partition (or perhaps, just in case, allow just
1GB swap)?
If you have the space then a small swap partition would be suggested. The small swap would allow paging if/when it should happen. With 4GB of RAM, you probably won't swap but if you happen to need it then a small swap would prevent problems.
That rule of thumb is for the maximum swap partition value, not the recommended. You don't need a swap partition at all, in fact you can also use swap files if you don't bother creating a swap partition, but decide you need swap later on: http://www.cyberciti.biz/faq/linux-a...ap-file-howto/
That rule of thumb is for the maximum swap partition value, not the recommended. You don't need a swap partition at all, in fact you can also use swap files if you don't bother creating a swap partition, but decide you need swap later on: http://www.cyberciti.biz/faq/linux-a...ap-file-howto/
It depends on the hardware. We helped a guy recently who did not set-up a swap partition and he encountered problems. In my opinion a small swap partition won't hurt the system.
I was under the impression, though I'm happy to be corrected if I'm wrong, that hibernation (or suspend to disk) uses the swap area too, so you'd need a swap partition at least as large as your RAM to use this feature.
That has been my understanding as well, that swap is used for hibernation. Of course, if that is not something you need or your hardware is capable of...
Personally I would put a small swap partition on any machine, no matter what the physical RAM may be. Though you will probably never use it, it is better to have a little something there for an emergency situation than the alternative of actually running out of memory if a process gets out of control. With storage as cheap as it is anymore, 256 - 512 MB isn't going to be missed by anyone with halfway modern drives.
The "RAM x 2" rule is absolutely antiquated now, don't let anyone tell you different. As you said, that was in the early days when people might only have 32 or 64 MB of RAM, and there was a very real possibility (almost a certainty) that at some point you were going to blow through your physical RAM. With 2 GB+ of RAM on modern machines, it just isn't going to happen unless you are doing something insanely intense like CAD or 3D animation, in which case you need to buy more RAM because clearly your application demands it. Keep in mind that swap is basically just there to keep the machine from crashing when it runs out of RAM, system performance when running from swap is going to be terrible.
I have 4 gigs of ram in my laptop, and the only time I see it swap (with conky) is during very large file transfers, like videos....I would definitely put a swap file there....forget the twice the ram thing, that's ancient I have a 2 gig swap btw.
Last edited by joutlancpa; 05-10-2009 at 12:56 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.