LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Thread Tools
Old 06-12-2008, 11:56 PM   #1
Rick069
Member
 
Registered: Feb 2005
Distribution: Mandriva
Posts: 165
Thanked: 0
Do I need a swap file to run linux?


[Log in to get rid of this advertisement]
Is there a relation between a linux swap file and ram? I have 6gb of ram and I'm wondering if I need a swap file.
Rick069 is offline     Reply With Quote
Old 06-13-2008, 12:10 AM   #2
jschiwal
Moderator
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 12,877
Thanked: 232
A swap file is used to save memory before going into hibernation. Some programs may assume the presence of swap. A very small swap partition should keep everything happy. Disk space is much cheaper than ram. Having a 1GB swap file shouldn't hurt.

One caveat is that if you have an eepc you don't want to have a swap file. Flash based filesystems have a limited number of writes.
jschiwal is offline     Reply With Quote
Old 06-13-2008, 12:13 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 2,904
Thanked: 271
Quote:
Originally Posted by Rick069 View Post
Is there a relation between a linux swap file and ram? I have 6gb of ram and I'm wondering if I need a swap file.
The amount of ram you have is not relevant. What's really relevant is the amount of ram you are going to use. If you have 6gb but you are going to run something that will be filling them them you need swap. If you have 256mb but you are going to run only a firewall on a headless box then you don't need swap.

The thing is simple as that. So, if you are lost, you could try defining the load that that box will have. For a regular desktop you are not going to hit swap easily with that amount of ram. Still, it doesn't hurt to have a one or two gigabytes partition lying around just in case. Note that, if the ram fills up, the kernel will swap, but if there's no swap space, it will just start killing programs without any consideration, and at that point, you might scream if it closes a document that you haven't saved for hours (not that you should do that, but things are not always as they should).

Some hibernation methods use swap to save an image of the ram. So, if you are going to use such a thing you will need to have a swap partition that's at least as big as your ram unless the image can be saved on a compressed form. I don't use hibernation so I don't really know much about that.

Last edited by i92guboj; 06-13-2008 at 12:15 AM..
i92guboj is offline     Reply With Quote
Old 06-13-2008, 01:42 AM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 5.4
Posts: 7,429
Thanked: 325
Yep, the swap partition gives you a grace period if the RAM fills up. The disk starts to thrash and the box becomes noticeably slower, but you can still do something about it... assuming you are sitting there at the time of course ...
chrism01 is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
swap file vs. swap partition verndog Ubuntu 5 05-09-2008 06:06 AM
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 09:04 AM
Sharing a swap file with linux and windows Doug Hammond LinuxQuestions.org Member Success Stories 5 07-11-2005 07:06 AM
2 linux distrubutions and one swap file? Rampage2884 Linux - Newbie 3 08-21-2003 02:36 AM
why does linux need swap file? futurist Linux - Software 8 08-20-2003 11:53 PM


All times are GMT -5. The time now is 02:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration