1833845 Members
2101 Online
110063 Solutions
New Discussion

Secondary swap

 
SOLVED
Go to solution
YAQUB_1
Respected Contributor

Secondary swap

Hi,

Could you please guide line to me, how I can create secondary swap space in my system under vg00 (H/W rp4440 & OS 11.23.

Please give me your feedback ASAP.

Regards-Yaqub
10 REPLIES 10
A. Clay Stephenson
Acclaimed Contributor

Re: Secondary swap

I'll assume that you have some free space on vg00.

1) Create a logical volume with contiguous allocation. I'll assume that it is mirrored as well. Let's pretend it is /dev/vg00/lvol9, size 8192MiB.

lvcreate -C y -m 1 -n lvol9 /dev/vg00

2) Next create an entry in /etc/fstab like this:
/dev/vg00/lvol9 ... swap pri=2 0 0

3) swapon -a



If it ain't broke, I can fix that.
Mel Burslan
Honored Contributor

Re: Secondary swap

let's say you want to add 4GB additional swap space and you have anough unused disk space on vg00

first create the logical volume
lvcreate -L 4000 -n lvsecswap -C y -r n /dev/vg00

then activate it with priority 1
swapon -p 1 /dev/vg00/lvsecswap

then check to see if it came online
swapinfo -ta

if everything looks okay, add it to your fstab so that it gets activated every time your system reboots

(edit /etc/fstab with editor of your choice and add this line below to it)

/dev/vg00/lvsecswap ... swap pri=1 0 1

hope this helps
________________________________
UNIX because I majored in cryptology...
A. Clay Stephenson
Acclaimed Contributor

Re: Secondary swap

Oops, I'm stupid.
This:
lvcreate -C y -m 1 -n lvol9 /dev/vg00
should be:
lvcreate -C y -m 1 -L 8192 -n lvol9 /dev/vg00
If it ain't broke, I can fix that.
Marco A.
Esteemed Contributor

Re: Secondary swap

This is the complete book that shows how create and configure your primary and secundary swap, on chapter 6.

http://docs.hp.com/en/B2355-90672/B2355-90672.pdf

Hope this helps,

Regards,
Just unplug and plug in again ....
A. Clay Stephenson
Acclaimed Contributor

Re: Secondary swap

One point: Are you sure that you need more swap? I have many systems that actually have much more memory than swap and they run just fine. Are you actually paging out? The old rules about 2-3X memory should be configured as swap space very seledom apply --- and haven't for about 2 decades.
If it ain't broke, I can fix that.
YAQUB_1
Respected Contributor

Re: Secondary swap

Hi Stephenson,

Thank you very much for your reply.

I will configer on my system secondary swap only 4GB. When I will mirror other lvol then secondary swap mirror or befor? If after then I will execute only for below command:

lvcreate -C y -m 1 -L 4096 -n lvol9 /dev/vg00 then creat /etc/fstab
/dev/vg00/lvol9 ... swap pri=2 0 0

Please confirm me.

Regards-Yaqub
Torsten.
Acclaimed Contributor

Re: Secondary swap

Regarding the mirror:

You can create a LVOL in a certain size, setup your swap and mirror

or

create the LVOL with a 0 size, mirror, extend the size and create your swap

the second procedure is much faster, but this is the only difference

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Secondary swap

Note that the "-m 1" option of lvcreate does the mirroring at the time the LVOL is created. You can do it later with an lvextend command but if you already have a mirrored root disk then you want to do it with vgcreate. Mirroring isn't absolutely required but it is a very good practice.

Your steps are:
1) lvcreate
2) Add a "swap" line to /etc/fstab.
3) swapon -a

I prefer this to the the swapon -e method which takes the options from the command line because the swapon -a command reads your /etc/fstab tab, checks for syntax, and enables any unused swap entries. This ensures that not only is your new swap space enabled now but also will be enabled at the next boot.

If it ain't broke, I can fix that.
YAQUB_1
Respected Contributor

Re: Secondary swap

Thanks all of your coopeartion....
Court Campbell
Honored Contributor

Re: Secondary swap

You really need to turn off the bad block relocation for swap as Mel shows with his lvcreate command(-r n).
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"