LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-02-2004, 03:02 AM   #1
LinToWinWin
Member
 
Registered: Mar 2004
Posts: 40

Rep: Reputation: 15
increasing the swap space after installing linux


Hi,

I have installed Mandrake Linux. I find that the swap space is used above 90% always. Hence, I want to increase the swap memory space. Please let me know how to do it.

Regards,
Shyam
 
Old 08-02-2004, 03:25 AM   #2
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi LinToWinWin,
It is easy to do. As you have already partitioned your disk, the most recommendable is to create a partition file. You must first create a file of desired length with "dd", then use mkswap to prepare it and after just enable swap. It is important the file be created with "dd" because it has to be a contiguous, not an sparse file. So, the commands to do it are
Code:
dd if=/dev/zero of="/path/to/your/swap-file" bs=1k count="your-need-in-MB"x1kx1k
mkswap="/path/to/your/swap-file"
swapon "/path/to/your/swap-file"
To swapon it on the start up, you have to add the following line in "/etc/fstab"
Code:
"/path/to/your/swap-file" swap swap defaults 0 0
"/path/to/your/swap-file" you must replace with your directory and file
"your-need-in MB" means the number of mega bytes you want. Observe we are multiplying bye 1kB two times. So, if you want 256MB, the command will be 256x1kx1k. If you want 1GB, you can put 1kx1kx1k.
Have fun!
PS. you can get more information on manual page for mkswap. Linux can work with more than one swap area.
 
Old 08-02-2004, 03:26 AM   #3
Kroenecker
Member
 
Registered: May 2003
Location: The States
Distribution: Gentoo
Posts: 245

Rep: Reputation: 30
This probably will involve fdisk as long as you have extra, unused, unformated space laying around on a hd. Read up about making a new swap partition using fdisk. Then change /etc/fstab to include a swap partition. Use man fstab to see the man pages about fstab.
 
Old 08-03-2004, 10:41 PM   #4
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Rep: Reputation: 34
Hi osvaldomarques

Ummm............I think your calculations are wrong in the "count=" option for the 'dd' command.............Since you're using a block size of 1k (bs=1k) the count will be in 1k blocks, so the count= option should be

count="your-need-in-MB"x1k

and not

count="your-need-in-MB"x1kx1k

(drop the extra x1k)


And to simplify it even more for the n00b, since you specifying a file size in MB, why not use a block size of 1MB (bs=1M) and then specify the count= option as a number of megabytes. For example, to create an empty file of 200 MB, use this command:

dd if=/dev/zero of=/path/to/your/swap-file bs=1M count=200

 
Old 08-03-2004, 10:51 PM   #5
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
HI thegeekster,
Man, you are right! Double right! I was consulting an old "man" where the multipliers went just until "1k". A translated manual. The reason I don't like translations. And you are also right of the excess of 1k's.
Thanks for the correction.

Osvaldo
 
  


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
deleting/resizing swap partition / increasing hd space saranga2000 Linux - Hardware 1 12-09-2004 11:03 AM
increasing swap on a slow pc ejbest Linux - Newbie 1 10-24-2004 11:30 AM
Increasing swap space rupesh_pulikool Linux - Networking 1 09-12-2004 11:40 PM
Linux swap space in FreeBSD rch *BSD 5 02-28-2004 12:57 PM
Increasing swap partition suneet123 Linux - Software 3 12-16-2002 04:11 PM


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