LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   question about swap... and adding more. (https://www.linuxquestions.org/questions/linux-newbie-8/question-about-swap-and-adding-more-890211/)

unix1adm 07-06-2011 07:02 AM

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

TobiSGD 07-06-2011 07:20 AM

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?

sundialsvcs 07-06-2011 07:28 AM

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.

unix1adm 07-06-2011 07:33 AM

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.

syg00 07-06-2011 08:17 AM

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 ?.

i92guboj 07-06-2011 09:47 AM

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.

TobiSGD 07-06-2011 10:49 AM

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.

jefro 07-06-2011 04:54 PM

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.


All times are GMT -5. The time now is 01:26 AM.