LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > 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
  Search this Thread
Old 06-12-2008, 10:56 PM   #1
Rick069
Member
 
Registered: Feb 2005
Distribution: Arch Linux
Posts: 204

Rep: Reputation: 30
Do I need a swap file to run linux?


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.
 
Old 06-12-2008, 11:10 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
Old 06-12-2008, 11:13 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
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-12-2008 at 11:15 PM.
 
Old 06-13-2008, 12:42 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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 ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 16 07-09-2012 08:49 PM
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 08:04 AM
Sharing a swap file with linux and windows Doug Hammond LinuxQuestions.org Member Success Stories 5 07-11-2005 06:06 AM
2 linux distrubutions and one swap file? Rampage2884 Linux - Newbie 3 08-21-2003 01:36 AM
why does linux need swap file? futurist Linux - Software 8 08-20-2003 10:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:59 AM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration