LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 06-18-2009, 04:33 PM   #1
anyzoo
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
How to increase size of swap space?


The size of my swap partiton, /dev/sda3 is 6144852k. But the size of the swap space is only 2097136k. How can make the size of swap space the same as the size of my swap partition, i.e. 6144852k?
 
Old 06-18-2009, 04:47 PM   #2
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
Which command do you use to see the size of the actual swap space? It's quite unusual to have it smaller than the swap partition... Of course,

mkswap /dev/sda3

should take care of that...
 
Old 06-18-2009, 04:48 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Hi, welcome to LQ!

Which version & release of Linux are you using? How did you
go about creating that swap? What's the output of
fdisk -l
and
free
?


Cheers,
Tink
 
Old 06-18-2009, 05:49 PM   #4
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
To me before wanting 6 gig swap space I add more ram. No idea what you are doing so can't say as to the needed size of swap. If you think it is twice the size of ram from something you read well that is old days when ram cost alot and ram in cpus were like 32meg. Now ram is cheap and you have way more than you one usually need. Just thought I ask before.

Unsure of the maximum size a swap partition can be but maybe create 3 - 2 gig swap partitions and then use that.

Brian
 
Old 06-18-2009, 06:31 PM   #5
anyzoo
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Original Poster
Rep: Reputation: 0
How to increase size of swap space?

The linux version is 2.4.21. The following is the output of fdisk and free. If I simply run the command "mkswap /dev/sda3", will I lose what's currently in the swap?

# fdisk -l

Disk /dev/sda: 146.8 GB, 146815737856 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 14 112423+ 83 Linux
/dev/sda2 15 1289 10241437+ 83 Linux
/dev/sda3 1290 2054 6144862+ 82 Linux swap
/dev/sda4 2055 17849 126873337+ f Win95 Ext'd (LBA)
/dev/sda5 2055 6377 34724466 83 Linux
/dev/sda6 6378 10201 30716248+ 83 Linux
/dev/sda7 10202 14025 30716248+ 83 Linux
/dev/sda8 14026 17849 30716248+ 83 Linux

# free
total used free shared buffers cached
Mem: 2055452 2008956 46496 0 268740 367788
-/+ buffers/cache: 1372428 683024
Swap: 2097136 1146500 950636
 
Old 06-18-2009, 06:52 PM   #6
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
I'd like to know what distro and version you've got; a 2.4 series kernel is pretty old. 2.6.x has been the std for a while.
 
Old 06-18-2009, 06:59 PM   #7
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,758

Rep: Reputation: Disabled
You have 2 GB of RAM and you need about ~ 1 GB of swap (less will do)... but you have enough.

swap is rarely used.

Use a more recent linux distribution like Fedora 11 or Kubuntu-9.04
 
Old 06-18-2009, 07:08 PM   #8
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
Yup. What I was afraid of...
2G was the swap partition limit for the 2.4 series of Linux kernels. There was no real point in allocating a 6G partition for it.
But you can (in theory) split it into three different swap partitions if you really want to.

Otherwise, you should really upgrade.
 
Old 06-18-2009, 07:46 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,491

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Same still applies(*) in 2.6 last time I looked. Redhat had a patch to use larger than 2 Gig extents, but only for the EL kernels I think. I don't recall the mkswap code being different for 64-bit, but I wasn't specifically looking for that at the time I checked.
Was a while ago - maybe I should check again sometime.

(*) - you can make it as large as you like and mkswap will "format" it all, only 2 Gig will actually be used.

Last edited by syg00; 06-18-2009 at 07:48 PM. Reason: Added footnote
 
Old 06-18-2009, 07:54 PM   #10
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
According to this http://www.gossamer-threads.com/list...kernel/1082431, that limit was removed after 2.3.3, if I follow the explanation correctly.
 
Old 06-18-2009, 08:02 PM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,491

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
That's talking about mkswap (code) - basically agreeing with what I said.
kswapd only uses 2 Gig (per extent) on x86; it [cs]hould be bigger on _64 but I have a feeling it's based on page size not addressing mode. As I said I'll need to go back into that code sometime.
 
Old 06-18-2009, 08:11 PM   #12
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
I had a feeling it was 2gb limit.
Brian
 
  


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
Increase SWAP Space? your_shadow03 Linux - Newbie 2 01-30-2009 05:52 AM
increase swap size ssilayaraja Linux - Newbie 5 08-18-2008 10:23 PM
How can I increase swap space? abefroman Linux - Server 12 12-27-2007 12:23 PM
how much swap space is needed; how to increase swap space? johnpaulodonnell Linux - Newbie 5 03-23-2007 04:20 AM
Increase Swap Space? star geezer Linux - Software 9 03-10-2003 01:04 PM


All times are GMT -5. The time now is 11:27 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration