LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-10-2005, 07:01 PM   #1
aznium
Member
 
Registered: Jun 2005
Posts: 36

Rep: Reputation: 15
Yet another swap question


I have a server running...and i stupidly forgot to add a swap partition to it when i installed it.
anyways, the hard drive (20 gig) contains one ext3 partition (also 20 gig)

my question is: lets say i run an intensive program that requires a lot of memory (ie 4 gig) . and the server only has 1 gig of physical memory, will the server crash if i run it? or just very slow performance?

solutions:
i do not have physical access to server - if anything goes wrong ... it will take a few days to get access to machine . and any downtime is unacceptable

1) resize the ext3 partition and add/mount a swap partition?

thanks
 
Old 12-10-2005, 07:34 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
yes it will crash
but first it will just run slow
Linux can use a file for swap

Last edited by foo_bar_foo; 12-10-2005 at 07:35 PM.
 
Old 12-10-2005, 08:12 PM   #3
aznium
Member
 
Registered: Jun 2005
Posts: 36

Original Poster
Rep: Reputation: 15
will the server crash? or will the program crash?
 
Old 12-10-2005, 08:28 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Indeterminate I would think.
If it's a server, isn't either an unacceptable result ???.

As foo_bar_foo indicated, you can use a file in lieu of a partition for swap. In 2.6 the alledged performance penalty has been rectified. Even if you are on a 2.4 kernel, the penalty would be worth taking.
You have a simple solution that requires no outage - why are you dithering ???.
 
Old 12-10-2005, 08:53 PM   #5
aznium
Member
 
Registered: Jun 2005
Posts: 36

Original Poster
Rep: Reputation: 15
if the program crashes, my core services would not be affected (ie. apache, postfix, etc)

if the server crashes (as in the kernel in whole), my core services would go down with it ... which is bad bad bad

how would i use a file as swap?
create a file such as /swap and mount it just like a swap partition?

also, yes i am using a 2.6 kernel (2.6.14 series i think, or 2.6.13)
 
Old 12-10-2005, 09:23 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Quote:
Originally Posted by aznium
if the program crashes, my core services would not be affected (ie. apache, postfix, etc)
You wish.
They would look like they have died if it takes something like 20 mins to get a response.
Quote:
how would i use a file as swap?
create a file such as /swap and mount it just like a swap partition?
Yep, have a look at tldp, (and the following section). It's old, but still valid - play with the sizes; multiple 2Gig files might be the best option.
 
Old 12-10-2005, 10:42 PM   #7
aznium
Member
 
Registered: Jun 2005
Posts: 36

Original Poster
Rep: Reputation: 15
thanks,

i have successfully created a swap file

to help others, wut i did was:

dd if=/dev/zero of=/swap-space bs=1M count=1024 #create a 1 gig zeroed in file (1megabyte * 1024)
mkswap /swap-space #convert that file to swap space
swapon /swap-space #enable it

that created an swap file of 1024 X 1M or 1 gig swap file
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
question about swap what0101 Linux - Newbie 3 09-19-2005 02:52 PM
Mount question and hot swap question Dr Gutiemouth Linux - Newbie 8 10-20-2004 12:30 PM
Swap Question powerismine Slackware 3 05-09-2003 12:40 AM
Swap question SchoolITguy Linux - General 6 12-04-2002 09:25 AM
Swap Question wonderpun Linux - General 3 09-08-2002 04:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:04 PM.

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