Operating System - HP-UX
1753890 Members
7407 Online
108809 Solutions
New Discussion юеВ

Re: Add swap space by creating another vg00 logical volume?

 
SOLVED
Go to solution
Adam Garsha
Valued Contributor

Add swap space by creating another vg00 logical volume?

I've got some unallocated space in my vg00 volume group and I am running low on paging space during peak hours. I'd like to create another logical volume from vg00 (mirrored) and allocate it to "swap" space, but I am not sure of all the steps. Also, which files need to be edited to ensure that the swap will be used after reboot (just /etc/fstab?). Thanks.
12 REPLIES 12
Pete Randall
Outstanding Contributor
Solution

Re: Add swap space by creating another vg00 logical volume?

Adam,

Take a look at "man 1m swapon". You need to create the LV, issue the swapon command, and add an entry to /etc/fstab indicating this as a swap volume.


Pete

Pete
James R. Ferguson
Acclaimed Contributor

Re: Add swap space by creating another vg00 logical volume?

Hi Adam:

I would suggest that you build your secondary swap on a non-vg00 volume group. I would also suggest that you make it the higher priority device; i.e. with a lower number where the primary swap device priority=1. Do something like:

# lvcreate -C y -r n -L 4096 -n lvol1 /dev/vg01

# swapon -p 0 /dev/vg01/lvol1

# echo "/dev/vg01/lvol1 ... swap pri=0 0 0" >> /etc/fstab

Regards!

...JRF...
Mauro Gatti
Valued Contributor

Re: Add swap space by creating another vg00 logical volume?

Hi Adam,
you have to create your LV in which you want to create swap space and then enable it using swapon command. Have a look at man 1m swapon to see all swapon option (for example you can create swap file on filesystem charing it with your datas or you can set priority of swap space just created).

RGDS

Mauro
Ubi maior, minor cessat!
Mauro Gatti
Valued Contributor

Re: Add swap space by creating another vg00 logical volume?

Hi Adam,
you have to create your LV in which you want to create swap space and then enable it using swapon command. Have a look at man 1m swapon to see all swapon option (for example you can create swap file on filesystem sharing it with your datas or you can set priority of swap space just created).

RGDS

Mauro
Ubi maior, minor cessat!
John Waller
Esteemed Contributor

Re: Add swap space by creating another vg00 logical volume?

Its something an experienced sys admin wouldn't dream of but you could always add it via SAM if you don't feel confident. Its under the disk and file systems section. Create the filesystem within vg00 then within swap you can add device swap then select using lvm. It will basically modify your /etc/fstab and run the swapon command for you.
Adam Garsha
Valued Contributor

Re: Add swap space by creating another vg00 logical volume?

I forgot to add that we will be having a downtime in a couple weeks to completely rebuild OS lv sizes. So this is just to get by (safely) until we can optimize. All current swap is on vg00, and I'd like to keep it that way for now.

Does this look correct? (remember mirrored vg00)

1.) lvcreate -m 1 -L 4096 -s y /dev/vg00
2.) swapon -p 1 /dev/vg00/lvol11
3.) edit /etc/fstab and add another swap entry
??

Am I missing anything (e.g. appropriate/special lvcreate flags)?
A. Clay Stephenson
Acclaimed Contributor

Re: Add swap space by creating another vg00 logical volume?

Since these swap areas are going on the same physical disk, you should choose a priority other than 1 (that of primary) because when swap partitions of equal priority are located on the same PV , the head will be moving like crazy. Having said that, it really doesn't matter because mixing performance and swap in the same sentence is dumb.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: Add swap space by creating another vg00 logical volume?

Since these swap areas are going on the same physical disk, you should choose a priority other than 1 (that of primary) because when swap partitions of equal priority are located on the same PV , the head will be moving like crazy). Having said that, it really doesn't matter because mixing performance and swap in the same sentence is dumb.
If it ain't broke, I can fix that.
Adam Garsha
Valued Contributor

Re: Add swap space by creating another vg00 logical volume?

Cool, what if I used priority of "2", since this is a "just in case" paging area anyhow.