LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-10-2008, 01:28 PM   #1
Ashhere
LQ Newbie
 
Registered: Aug 2008
Posts: 25

Rep: Reputation: 15
Smile Setting swap memory size...


Hi,

How can I change the swap file settings in ubuntu?
 
Old 12-10-2008, 01:53 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,750

Rep: Reputation: 271Reputation: 271Reputation: 271
You use the swapon and swapoff commands.

See:

man swapon

man swapoff

---------------------------
Steve Stites
 
Old 12-10-2008, 02:14 PM   #3
Ashhere
LQ Newbie
 
Registered: Aug 2008
Posts: 25

Original Poster
Rep: Reputation: 15
Sorry. Its that I am not upto with the commands.

Can you please explain a bit more. I mean if I need to set the memory in a drive,say D(hope its possible),of size 1gb, how to specify the arguments? And also, what does this a,e,v and s in the terminal? If you could temme a link where I can get the command descriptions...!!

Thanks.
 
Old 12-10-2008, 02:54 PM   #4
malaprop
LQ Newbie
 
Registered: Dec 2008
Location: TX
Distribution: Ubuntu 8.10
Posts: 26

Rep: Reputation: 16
You set the swap size while partitioning a disk.
That can get tricky, as you can completely destroy things if you mess up.

do you have a swap space you are wanting to resize? Or did you add a new drive to the mix that you want to use for swap space?
 
Old 12-10-2008, 03:48 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,930

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
It would help if you actually asked a proper question. Do you want more or less swap?

How much RAM do you have (Just for reference)? How much swap do you presently have? How much swap do you need. Is this computer a desktop or a laptop?

linux's primary swap area is a separate partition vs windows which uses a file. Setting swap size is slightly more complex then windows.

There are actually three ways to increase the size of swap.
1. Resize your current swap partition.
2. Create an additional swap partition
3. Create a swap file.

The first two depend on how the drive is partitioned and if you have some unused space. The third is the easiest. A swap file is slower then a partition.

To decrease would be to perform the opposite operation.
 
Old 12-10-2008, 04:52 PM   #6
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,750

Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by Ashhere View Post
Can you please explain a bit more. I mean if I need to set the memory in a drive,say D(hope its possible),of size 1gb, how to specify the arguments?
If you have at least 256 Meg of RAM you can probably run without any swap at all. Use the swapoff command to turn swap off completely:
swapoff -a

Then you can do whatever you want to do with your swap partition, make it bigger, smaller, create two or more, or whatever. After you get the swap partition(s) set up the way you want then you format the swap partition(s) with the mkswap command (see: man mkswap)

You can also create one or more swap files instead of swap partitions but as michaelk said swap partitions run faster than swap files.

You then change /etc/fstab to describe your new swap configuration correctly. Then you turn swap on with the swapon command:

swapon -a

-----------------------
Steve Stites
 
Old 12-10-2008, 07:16 PM   #7
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Quote:
You can also create one or more swap files instead of swap partitions but as michaelk said swap partitions run faster than swap files.
Would this still be valid? I seem to remember and interview with Linus where he said that the difference has become negligeable.
 
Old 12-10-2008, 08:13 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,832

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
No difference since 2.5 - swap now uses the normal block driver(s) for I/O for both.
 
  


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
Question on setting swap partition(size and spltting it to 2 drives) Arodef Linux - Software 4 11-16-2004 05:15 AM
Why should you give the size of the swap disk as twice the size of RAM vmniza Linux - Newbie 3 09-17-2004 03:13 AM
SWAP memory size ust Linux - Software 3 12-02-2003 07:42 PM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 08:58 PM
setting video card memory size Logic Linux - Software 1 07-20-2003 12:51 PM


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