1832648 Members
3028 Online
110043 Solutions
New Discussion

Re: Swap size

 
Fred Ruffet
Honored Contributor

Swap size

Hi !

I have here a server with 4GB of RAM. It is newly installed and has only 1GB Swap created at install time. I'd like to increase this swap to 8GB (twice the RAM) and have afew questions :

. Can I extend swap LV to 8GB ? This wouldn't be contiguous anymore. Is it a problem ?
. Can I create an other 7GB LV for swap ? This would give 8GB but it wouldn't be more contiguous than first solution. What happen if a crash occurs, and system dumps ?
. Is it better to have 8LV of 1GB than 1LV of 8GB or 1 of 1GB and 1 of 7GB ?

Thanks for any replies.

Fred
--

"Reality is just a point of view." (P. K. D.)
13 REPLIES 13
MarkSyder
Honored Contributor

Re: Swap size

If you have more than one disc, it's recommended to have swap areas on each. This way, the two areas can be used in parallel to avoid too much io on the main swap area.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Slawomir Gora
Honored Contributor

Re: Swap size

Hi,

swap must be created with contiguous
allocation policy so you can't extend your 1GB swap online.

You can create new contiguos LV 7GB and add new swap area.

You can always make tape recovery and
during restore process extend your primary 1GB
swap to 8GB.

It is better to have 1LV of 8GB.


Fred Ruffet
Honored Contributor

Re: Swap size

Thanks Mark !

I have 2 internal disks. Should I go for half swap on each disk ? (4GB on each)

This make me ask an other question : Is it better not to mirror swap LVs ?

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Fred Ruffet
Honored Contributor

Re: Swap size

Slawomir,

Thanks for your answer. First I wanted to go for 1 LV of 8GB, but as Mark said, that would maybe be better to have 2 LV of 4GB, each one on an internal drive... except if someone here tells it is better to mirror. In that case, I would go for 1 single 8GB LV.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Eric Antunes
Honored Contributor

Re: Swap size

Hi Fred,

I also think you should use 2 different logical volumes for this. I've this solution, only with different sizes on my servers as you can see from my swapinfo command:

Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1024 67 957 7% 0 - 1 /dev/vg00/lvol2
dev 1024 65 959 6% 0 - 1 /dev/vg00/lvol9
reserve - 1132 -1132
memory 1129 268 861 24%
total 3177 1532 1645 48% - 0 -

Regards,

Eric Antunes
Each and every day is a good day to learn.
MarkSyder
Honored Contributor

Re: Swap size

I would try to go for half on each disc, but if you're short of space on the root disc or don't want to go through the hassle of using an ignite tape I can't see any problem with having a larger area on your application disc - in fact, that's the very setup I've got on some systems.

Mark
The triumph of evil requires only that good men do nothing
Fred Ruffet
Honored Contributor

Re: Swap size

Thanks for aswers.

No problem for space. What I have in mind is the following : I have 2 internal 36GB disks wich I want to use for OS mirroring. I want to mirror anything except swap which will be composed of 4GB on each drive.

All of that because I heard mirroring swap is very bad for performance purpose.

Is it bad ? good ? better to have 8GB mirrored ?

Eric, are this swap devices mirrored ?

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Hoang Chi Cong_1
Honored Contributor

Re: Swap size

Hi Fred

No, you won't be able to increase current swap space (default in /dev/vg00/lvol2)
Why don't you creat for second swap space?
You can use this command to create:

lvcreate -L xxxM -C y -r n /dev/vgxx/lvolx

regard,

Jimkery
Looking for a special chance.......
Slawomir Gora
Honored Contributor

Re: Swap size

Hi,

if you use mirror for local system disks
swap lvols must be mirrored too.

If there will be no mirror for swap then when
one disk is broken you lose some swap space
and your system will hang.
Victor BERRIDGE
Honored Contributor

Re: Swap size

Hi Fred,
If its OS internal you must mirror also (all) the swap...
If you had other disks, than you could have created secondary swaps of same size so that in case of swaping it would write on all at the same time...

All the best
Victor
Saurav_1
Valued Contributor

Re: Swap size

You are right. Why mirror the swap?
But in case if it is required to boot from the mirrored disk, that time which LV will be the primamry swap space. I hope you understand why is it required to mirror swap.

2) Pripary swap must be of the size of RAM of system. Because it acts as dump device when system crashes and data in the memory is dumped here so 1 GB of primary swap is not a good IDEA atall.

cheers.
Saurav
Fred Ruffet
Honored Contributor

Re: Swap size

Slawomir, that's the point. As I was searching on forums, I just found an answer from Patrick Wallek saying that you must mirror swap as long as if you boot on mirror, you need your primary swap.

So I will go for everything mirrored on this system. I'm going to try to have a "single contiguous 8GB primary mirrored swap", and that will be the best (I think).

Thanks all.

Fred
--

"Reality is just a point of view." (P. K. D.)
Fred Ruffet
Honored Contributor

Re: Swap size

Thanks all for replies.

Fred
--

"Reality is just a point of view." (P. K. D.)