Operating System - HP-UX
1834636 Members
3682 Online
110069 Solutions
New Discussion

Creating swap on non-vg00 disks

 
SOLVED
Go to solution
dictum9
Super Advisor

Creating swap on non-vg00 disks

This is an L class running 11.23

I need to create additional swap space but I've ran out of space in vg00 VG. Can I use a different volume group based on external storage array? I really don't seem to have any alternatives as the root disks are 35GB and full.
13 REPLIES 13
Jaime Bolanos Rojas.
Honored Contributor
Solution

Re: Creating swap on non-vg00 disks

Hi etc,

Long time without posting overhere...

You might want to take a look at this thread, it contains links to other threads that have the syntax to do it.

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1063451

Actually the best way to to put in in another vg with a different priority and external disk array does not give any issues at all.

Regards,

Jaime.

Work hard when the need comes out.
DCE
Honored Contributor

Re: Creating swap on non-vg00 disks



There is no issue with it at all.

A couple of itmes though

set it to a lower priority than the swap in vg00

Keep the swap in vg00 - without it booting the system could be interesting - especially in single user mode.

You always should have some swap in vg00

Geoff Wild
Honored Contributor

Re: Creating swap on non-vg00 disks

Yes you can do this - I have a few servers with swap on EMC.

Create a different vg for it.

Example:

Create vg01:

pvcreate /dev/rdsk/c25t0d0
pvcreate /dev/rdsk/c25t2d0
vgcreate -s 8 -p 128 /dev/vg01 /dev/dsk/c25t0d0 /dev/dsk/c25t2d0
vgchange -a y /dev/vg01


lvcreate -C y -L 16384 -n lvswap /dev/vg01

/usr/sbin/swapon -f -p 3 /dev/vg01/lvswap

add to /etc/fstab:

/dev/vg01/lvswap ... swap pri=3 0 0

Mirror it:
lvextend -m 1 /dev/vg01/lvswap /dev/dsk/c25t2d0


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
James R. Ferguson
Acclaimed Contributor

Re: Creating swap on non-vg00 disks

Hi:

Yes, you can create secondary device swap on any volume group you want.

Remember to add the *secondary* swap to '/etc/fstab' to enable its automatic activation the next time you boot.

Regards!

...JRF...
Pete Randall
Outstanding Contributor

Re: Creating swap on non-vg00 disks

Yes you can, simply set up your logical volume (don't put a file system on it) and use the swapon command to enable it for swap. Have a look at the man page for swapon.


Pete

Pete
dictum9
Super Advisor

Re: Creating swap on non-vg00 disks

Does this look good? I didn't realize about the priority, should I redo it?
Also, I don't want to mirror it, since it's on EMC anyway which uses internal RAID.

# swapinfo
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 10485760 0 10485760 0% 0 - 1 /dev/vg00/lvol2
dev 10485760 0 10485760 0% 0 - 1 /dev/vgignite2/swap2
reserve - 209384 -209384
memory 5242880 1172940 4069940 22%
Victor BERRIDGE
Honored Contributor

Re: Creating swap on non-vg00 disks

As others have already answered...
e.g.
mira:/home/vbe $ swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 2048 0 2048 0% 0 - 1 /dev/vg00/lvol2
dev 2060 0 2060 0% 0 - 1 /dev/esvg01/lvol2
dev 2048 0 2048 0% 0 - 1 /dev/esvg02/lvol2
reserve - 730 -730
memory 2193 774 1419 35%
total 8349 1504 6845 18% - 0 -
mira:/home/vbe $

The idea for good perfs is to have all swaps on different controllers and of same size!
so if swapping occurs it will use make usage of all the swaps at same time balancing the load...


All the best
Victor
dictum9
Super Advisor

Re: Creating swap on non-vg00 disks

Is it OK that both of my swap partitions, the primary and the secondary, have the priority "1"?

The second one is on the EMC disks, I am not sure this is right. I wanted to make it p=2 but don't know how to undo it.
Victor BERRIDGE
Honored Contributor

Re: Creating swap on non-vg00 disks

What you did is just fine...


All the best
Victor
P.S. my example esvgXX is SAN (XP1024) using PVG....
James R. Ferguson
Acclaimed Contributor

Re: Creating swap on non-vg00 disks

Hi (again):

As for priority of your swap devices, I'd make the secondary swap device a lower value (i.e. zero (0)) than the primary device swap. This means that your secondary swap would be used in preference.

While this doesn't matter if you are not actually swapping (and you don't want to come to that!), in the event that actual swap I/O does occur, you will not degrade your vg00 performance as badly.

See the manpages for 'swapon(1M)' for more information.

Regards!

...JRF...
Victor BERRIDGE
Honored Contributor

Re: Creating swap on non-vg00 disks

oups pressed enter to soon...
should read at the end and stripes:
LV Name /dev/esvg01/lvol2
LV Status available/syncd
LV Size (Mbytes) 2060
Current LE 515
Allocated PE 515
Used PV 6

LV Name /dev/esvg02/lvol2
LV Status available/syncd
LV Size (Mbytes) 2048
Current LE 512
Allocated PE 512
Used PV 4
dictum9
Super Advisor

Re: Creating swap on non-vg00 disks

quote:
---------------
As for priority of your swap devices, I'd make the secondary swap device a lower value (i.e. zero (0)) than the primary device swap. This means that your secondary swap would be used in preference
-----------------



Interesting idea, I will think about it. How would one do it, anyway? Do I have to delete the swap and then recreate it? There doesn't seem to be a "swapoff" command or any options to "swapon" to delete a swap partition.
James R. Ferguson
Acclaimed Contributor

Re: Creating swap on non-vg00 disks

Hi Etc:

Yes, I'm afraid that you need to reboot to change the priority of the swap device. Change the priority in '/etc/fstab' for the secondary device and reboot.

As noted, however, to some extent this is all splitting hairs. You don't want to swap in the first place. If you have enough memory you won't and the whole argument becomes moot.

I would make sure that 'swap_mem=on' in your kernel thus enabling "pseudoswap". This means that the kernel counts 75% of your physical memory for the purposes of satisfying process swap reservation. With sufficient memory, you don't have to waste valuable disk for device swap.

Regards!

...JRF...