LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 07-06-2011, 07:02 AM   #1
unix1adm
Member
 
Registered: Oct 2008
Posts: 688

Rep: Reputation: 32
question about swap... and adding more.


I have a rel 5.6 system that we just added more memory to.

1. What is the correct or best way to increase swap?
2. Can I remove the swap space later on?
3. How do you remove it when done?

Our rootvg only has 8G available to it and I want to be sure if i allocate anything out to it I can reclaim when done without having to rebuild the system.



We have to do a lot of data moves so we allocated extra memory to this VM system and now we need to increase swap.

I did see several articles in google but they describe using a new swap partition, a swap file and increasing an existing swap space.

I am still not sure what is the best way to go knowing this is a temp situation.

here are some stats on the system

free
total used free shared buffers cached
Mem: 3865620 921672 2943948 0 212848 510804
-/+ buffers/cache: 198020 3667600
Swap: 4095992 0 4095992

vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 2943080 213748 510840 0 0 5 108 211 133 0 0 99 0



rootvg:

Alloc PE / Size 733 / 22.91 GB
Free PE / Size 287 / 8.97 GB

cat /proc/swaps
Filename Type Size Used Priority
/dev/mapper/rootvg-LogVol01 partition 4095992 0 -1

Last edited by unix1adm; 07-06-2011 at 07:07 AM.
 
Old 07-06-2011, 07:20 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
You have given your machine more memory and doesn't use swap at all, according to the output of free. Why do you want to add more swap-space at all?
 
Old 07-06-2011, 07:28 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
RAM is cheap enough and plentiful enough these days that swap-space is much less important. I think that you should have some, but the old saws that it should be some n% of RAM have begun to lose their former meaning.

I see nothing to persuade me that you have a legitimate cause for concern here.
 
Old 07-06-2011, 07:33 AM   #4
unix1adm
Member
 
Registered: Oct 2008
Posts: 688

Original Poster
Rep: Reputation: 32
well the system is idle now we have not started the data move. thats why you dont see any high usage on it. I want to increase the swap before they do it.
 
Old 07-06-2011, 08:17 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Create swap {partition,file} as you see fit. mkswap on it as per your googled articles. Use swapon to activate the new space.
Do your work, use swapoff to deactivate the added swap. Then delete the extents.

How hard is that ?.
 
Old 07-06-2011, 09:47 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
You can create a file of any length using

Code:
dd if=/dev/zero of=/swap01.img bs=A count=B
Where A is the block size and B is the number of times you will write that size. The size of the image is AxB.

'mkswap' will format that file adequately.

Finally, you can add the swap using swapon, and remove it using swapoff. You can also put it in fstab just like a regular swap partition, and you can add as many swap files as you wish. Read the man pages for dd, swapon and swapoff, they might be helpful.
 
1 members found this post helpful.
Old 07-06-2011, 10:49 AM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
You already have 4GB of swap. If you really need more than 4GB of swap you should think about the dimensioning of the machine. If it uses that much swap I would assume that you don't have dimensioned that machine according to its workload. It will be really slow. You should add more RAM.
 
Old 07-06-2011, 04:54 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
Look at the different ways posted above for a swap file and a swap partition. It may suite you to make a swap file. They may be a bit easier to play with.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding more SWAP after adding memory marc1978 Linux - General 6 03-19-2006 07:13 PM
boot up delay (adding swap space) question saunders1m Ubuntu 4 02-19-2006 03:29 PM
adding swap space gadekishore Linux - Networking 2 02-18-2006 12:32 PM
Adding swap space sbrewer Linux - Distributions 4 12-19-2004 04:32 AM
adding swap space jamaso Slackware 6 06-20-2004 11:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:53 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