LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 08:02 AM   #1
unix1adm
Member
 
Registered: Oct 2008
Posts: 649

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 08:07 AM.
 
Old 07-06-2011, 08:20 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852
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, 08:28 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,624
Blog Entries: 4

Rep: Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999
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, 08:33 AM   #4
unix1adm
Member
 
Registered: Oct 2008
Posts: 649

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, 09:17 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,955

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
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, 10:47 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,074

Rep: Reputation: 386Reputation: 386Reputation: 386Reputation: 386
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, 11:49 AM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852
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, 05:54 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 17,101

Rep: Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552
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


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
Adding more SWAP after adding memory marc1978 Linux - General 6 03-19-2006 08:13 PM
boot up delay (adding swap space) question saunders1m Ubuntu 4 02-19-2006 04:29 PM
adding swap space gadekishore Linux - Networking 2 02-18-2006 01:32 PM
Adding swap space sbrewer Linux - Distributions 4 12-19-2004 05:32 AM
adding swap space jamaso Slackware 6 06-21-2004 12:05 AM

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

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