Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

Swap Guidelines

Ralph Grothe
Honored Contributor

Swap Guidelines

Hi forumers,

we got a new L-box which I have to prepare for dbms installation.
So far I successfully mirrored the Root VG which also holds a 4 GB primary swap device in /dev/vg00/lvol2.

Since the box is furnished with 15 GB RAM, and supposed to host an SAP dbms (need I tell anything more about resource greed ;-) I guess that at least 15 GB device swap will be required.

Having another two spare internal disks (dbms later stores to EMC) of 18 GB I would like to create a mirrored VG of them to host a ca. 14 GB LV for secondary swap.

These are my questions.

1st how to create the VG (i.e. should I overwrite the standard PE size of 4 MB with e.g. "-s 8", what value to use with the -e flage to set Max PEs)?

2nd how to create the swap LV(s) thereon?
Would it be better to split into several smaller LVs, or would one big chunk do (would be on the same disk anyway, as far as performance is concerned)?
Which flags to use?
I guess I will have to enforce contiguous (i.e. -C y), and strict allocation (i.e. -s y).
What abaout bad block relocation (i.e. -r)?
Where on the disk (if this is influencable) to put the Swap area (i.e. lvol1 or lvol$NF)?
In /etc/fstab what order (i.e. option pri=) to select?

Madness, thy name is system administration
James R. Ferguson
Acclaimed Contributor

Re: Swap Guidelines

Hi Ralph:

My choice would be to use the standard LVM PE size. I'd build multiple logical volumes for your secondary swap, each being the same size as your primary swap. I'd also make sure that the swap priority is equal on *all* swap spaces. In this way, you should get the most even distribution of swap I/O (interleaving).

The easiest way to setup swapspace is via SAM.

Jim Turner
Esteemed Contributor

Re: Swap Guidelines


James is right on the mark (as usual). Spread equally-prioritized swap LV's across as many spindles as possible. You may also want to enable pseudoswap. I don't know what you will be using for your database s/w, but Oracle has a psychopathic desire to reserve absurd amounts of swap that it will likely never actively use on a large memory model. Even if it never *uses* it, if it can't reserve it, Oracle will piss and moan about it.

If you're planning on SWAP+DUMP, let's talk DUMP details. Assuming you don't configure selective dump, make sure you have as a bare minimum DUMP capacity of physical RAM plus kernel. This begs the case of also having a generous amount of room in /var so the dump can be saved to /var/adm/crash/crash.? afterwards. Last I checked, DUMP had to be within the first four gig of each PV.

I had to give my Data Warehouse N4000 (8GB phys RAM) nearly 30GB of swap before Oracle would shut up and work correctly. While that seems excessive, I've got nearly 2TB of data. Fun, huh?

All The Best,

Was this information helpful? If so, please like and give kudos. Thanks!
Deshpande Prashant
Honored Contributor

Re: Swap Guidelines

I would use SAM to create seperate VG for swap.
Create swaps of same sizes of primary. Increase default max PE(16), if you intend to use more disks.Increase "max pe per pv" if the disks are of different sizes and intend to add higher capacity disk at later time.

The bad block allocation should be on for internal disks wile it shold be off for the EMC disks.
Take it as it comes.
Ralph Grothe
Honored Contributor

Re: Swap Guidelines

Many thanks for your hints.

Unfortunately I cannot distribute the swap areas over sevaral spindles, because I'm limitted with diks.

Even though it may not have been the soundest decission I allocated just one big secondary swap device.

My swap devices are now those:

# swapinfo -ta
dev 4194304 0 4194304 0% 0 - 1 31,0x012003
dev 14336000 0 14336000 0% 0 - 1 /dev/vg01/sswap1
reserve - 274008 -274008
memory 1152604 1013528 139076 88%
total 19682908 1287536 18395372 7% - 0 -

# grep swap /etc/fstab
# secondary device swap LVs
/dev/vg01/sswap1 ... swap pri=1 0 0

# lvlnboot -v
Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
/dev/dsk/c1t2d0 (0/0/1/1.2.0) -- Boot Disk
/dev/dsk/c2t2d0 (0/0/2/0.2.0) -- Boot Disk
Boot: lvol1 on: /dev/dsk/c1t2d0
Root: lvol3 on: /dev/dsk/c1t2d0
Swap: lvol2 on: /dev/dsk/c1t2d0
Dump: lvol2 on: /dev/dsk/c1t2d0, 0

As you can see, so far there is only one rather small dump area

# lvdisplay /dev/vg00/lvol2
--- Logical volumes ---
LV Name /dev/vg00/lvol2
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 1
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 4096
Current LE 1024
Allocated PE 2048
Stripes 0
Stripe Size (Kbytes) 0
Bad block off
Allocation strict/contiguous
IO Timeout (Seconds) default

I think I will have to extend this dump area to at least a size similar to my physical RAM to accomodate a crash dump at a panic, wouldn't you agree?
I think to have read somewhere that this is only possible while in LVM maintenance mode.
(do I get there whith "ISL> hpux -m" ?)
What flags will I then have to supply to lvchange?

Finally there is one strange thing with my Root mount since the last reboot.
Now some /dev/root is mounted instead of /dev/vg00/lvol3.
How come?

# grep ' / ' /etc/fstab
/dev/vg00/lvol3 / vxfs delaylog 0 1
# bdf /
Filesystem kbytes used avail %used Mounted on
/dev/root 143360 31437 104940 23% /

Madness, thy name is system administration
Honored Contributor

Re: Swap Guidelines

1.I would prefer to stick to original PE size(4 Mb)
2. i would split the swap across all the VG's with same priority(1) and make total swap space equal to ram size(15GB).
swap can be created by making entry in fstab file and use swapon command or you can create by using SAM.
never give up
Rita C Workman
Honored Contributor

Re: Swap Guidelines

Hi Ralph,

Well the way you set up your additional device swap may not be 'the best' but it will work.
Now on to that point about your lvol2 and crash dump statement. You can not just increase lvol2....unless you can confirm that it is increased on contiguous disk space. And I wouldn't want to touch trying to do that (..I'm not that smart..). To increase lvol2 most folks tend to re-ignite the server. Now there are some threads that suggest moving lvol2 (and other root lv's) around until you free up enough contiguous space than moving lvol2 back and increasing, then moving the other lvols back...but whew...the work !!

Just thought I'd touch base on these points,
Jim Turner
Esteemed Contributor

Re: Swap Guidelines

Rita and Ralph,

I actually have increased lvol2 contiguously before. You have to pvmove the lvol that immediately follows lvol2 to a different disk. Once the contiguous space following lvol2 is free, you can extend lvol2.

A geek's work is never done ;-)

Was this information helpful? If so, please like and give kudos. Thanks!