Operating System - HP-UX
1833772 Members
2094 Online
110063 Solutions
New Discussion

Re: Problem extending swap space

 
Declan Heerey
Frequent Advisor

Problem extending swap space

I am trying to extend my servers swap space. I have 2x 8Gb disks(mirrored) which i have freed up and removed from there original volumn group / logical volumn. The steps i have taken to allocate these disks as swap is as follows;

1) umount /DB_PP4
2) lvreduce -m 0 /dev/VG_PP/lvol4 /dev/dsk/c0t6d0 (primary disk)
3) lvremove /dev/VG_PP/lvol4 (original vol group)
4)vgreduce /dev/VG_PP /dev/dsk/c0t6d0
5)vgextend /dev/vg00 /dev/dsk/c0t6d0 (extend vg00 volumn group to use primary disk)
6) lvcreate -L 4000 /dev/vg00 (create lvol9 - swap)

My problem is what i do now? How do i add the second device to this new lvol and How do i mirror the new volumn group with the 2nd physical disk (/dev/dsk/c1t1d0)? i have tried lvextend -m 1 /dev/vg00/lvol9 /dev/dsk/c1t1d0 bu this does not work.

Also what then?? do i just add the additional swap space with swapon /dev/vg00/lvol9? or do i have to do something else?

Any help appreciated

Declan
15 REPLIES 15
twang
Honored Contributor

Re: Problem extending swap space

For load blancing, I prefer add another one, you may use following method to add swap:
sam > :Disks and File Systems> Swap > Action (menu) > Add Device Swap/Add File System Swap (menu item)


Jeff Schussele
Honored Contributor

Re: Problem extending swap space

Hi Decan,

First, IMHO, you should have created a new VG for this swap. But let's proceed down the road you're on.

You need to add the other disk to vg00 that will mirror this secondary swap

vgextend vg00 /dev/dsk/c1t1d0

Then extend the swap LV to this new device

lvextend -m 1 /dev/vg00/lvol9 /dev/dsk/c1t1d0

Now edit the /etc/fstab file for this new swap device This insures it's enabled at all subsequent boots - add the following:

/dev/vg00/lvol9 ... swap pri=0 0 0

Then enable the new swap:

swapon -a

It's possible that you may need to extend some kernel parameters to allow this new swap space.
See maxswapchunks & swchunk
The system will tell you that you need to do this when you try to enable it. This will require a reboot.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Stefan Farrelly
Honored Contributor

Re: Problem extending swap space

Yu need to ensure both disks are in the same VG to mirror. Is c1t1d0 in vg00 ? if not add it in then lvextend -m 1 /dev/vg00/lvol9 /dev/dsk/c1t1d0

This will do the mirroring. It will take a while to mirror 4GB though.

To activate the swap do;
1. add it into /etc/fstab;
/dev/vg00/lvol9 / swap defaults 0 0 # secondary swap
2. swapon -a

Thats it, all done!
Im from Palmerston North, New Zealand, but somehow ended up in London...
Massimo Bianchi
Honored Contributor

Re: Problem extending swap space

Hi,
there are a number of points:

- first: have you enough space left to mirror the swap on another phisycal disk ?

please post a "vgdisplay -v vg00"

- are your kernel parameter enough to host so much swap ?

please post your /stand/system

- when you created the lvol, did you specify the (-C y -M n) option to have it contiguos and with no mirrir write cache ? it looks like not...


- after that, you can use SAM to add the swap,
or add it by yourself editing the /etc/fstab and doing a "swapon -a"


HTH,
Massimo


James R. Ferguson
Acclaimed Contributor

Re: Problem extending swap space

Hi Declan:

If all you want to do is add a secondary swap, then don't add it to vg00. It would be better to add it to another volume group and leave vg00 as a single physical disk volume group.

On a non-vg00 volume group, create a secondar device swap and set its swap priority to 0 so that is is used in preference to primary swap:

# lvcreate -C y -r n -L -n lvolN /dev/vgXX #...a secondary swap (n * 256)
# swapon -p 0 /dev/vgXX/lvolN

Regards!

...JRF...
Marco Santerre
Honored Contributor

Re: Problem extending swap space

From the point where you are at :

Basically, now that your lvol has been created all you need to do to enable your swap is

#swapon /dev/vg00/lvol9

And that should activate your swap. It is probably a good idea to also include the Lvol in your /etc/fstab with something like that :

/dev/vg00/lvol9 ... swap pri=2 0 0

So that it starts your swap on this lvol every time you boot.

As for mirroring this swap : I do not know how many disks are in your VG00 at this point, but once your lvol is created, all you need to do is :

#lvextend -m 1 /dev/vg00/lvol9 /dev/dsk/mirrordisk

where mirrordisk would be the exact filename of the disk you plan to use and have your mirror on to.

Since you are using c1t1d0 as your mirrordisk, it should work, now what error message did it gave you when you tried this command?
Cooperation is doing with a smile what you have to do anyhow.
Stuart Abramson_2
Honored Contributor

Re: Problem extending swap space

Declan:

You have two questions:
1. How do I mirror LVs?
2. How do I add swap?

2. Extend swap:

lvcreate -C y -r n -n swap02 vg00 # create swap volume
# Contiguous
# No bad block reloction
lvextend -L 1996 /dev/vg00/swap02 /dev/dsk/c5t9d0 # assign to 2nd disk

# modify /etc/fstab
echo "/dev/vg00/swap02 ... swap pri=2 0 0" >> /etc/fstab

# turn swap on..
swapon -a # all /etc/fstab swap

4. If there was a file system on this LV before, you must:

swapon -f /dev/vg00/swap02


Declan Heerey
Frequent Advisor

Re: Problem extending swap space

vgextend /dev/vg00 /dev/dsk/c1t1d0 and
lvextend -m 1 /dev/vg00/lvol9 /dev/dsk/c1t1d0

both return the message;

vgextend: "/dev/dsk/c1t1d0": No such file or directory
lvextend: "/dev/dsk/c1t1d0": No such file or directory
Declan Heerey
Frequent Advisor

Re: Problem extending swap space

When i view swap options in SAM the 4Gb of free space is available in lvol9 vg00. I grasp from the replies how i can either add this additional space to swap using SAM or spawon but do i still have unfinished problems with mirroring the lvol9?
Jean-Louis Phelix
Honored Contributor

Re: Problem extending swap space

Hi,

I haven't seen anything in your post about adding /dev/dsk/c0t1d1 in vg00. To be used as a mirror for lvol9 it must be first one of the disks of vg00, so yoy have to vgextend first.

Regards.
It works for me (© Bill McNAMARA ...)
Jeff Schussele
Honored Contributor

Re: Problem extending swap space

OK - these messages indicate that /dev/dsk/c1t1d0 is not a valid device on your system.
You need to determine just what that device is - run:

ioscan -funC disk

And determine just *what* the device for that 2nd 8Gb disk is.

Then you *may* need to initialize it:

pvcreate /dev/rdsk/cXtYdZ

you may need -f to force the init - but be DARN sure of the proper device because this WILL destroy any LVM info on that device.

Then just follow the steps as laid out earlier using the proper device.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Marco Santerre
Honored Contributor

Re: Problem extending swap space

Well, it defintiely looks like the disk that you are talking about is not recognized by the system period.

#ioscan -fnC disk

will show you which disks are seen by your system. If some filenames are missing, maybe even a

#insf -e

would help.

Again, as already mentionned, if you do a pvcreate, MAKE SURE that the disk is not already used for another purpose. And also, make it is already part of VG00. Then you can lvextend.
Cooperation is doing with a smile what you have to do anyhow.
Declan Heerey
Frequent Advisor

Re: Problem extending swap space

Jeff,

I think you have hit the nail on the head -/dev/dsk/c1t1d0 is not appearing in my ioscan as a disk although i was sure that was the dev that was mirroring my original VG (now trashed to make the additional swap). I'll have to go back a few steps and try and find the 2nd disk before continuing. I'll post an update of my progress and assign points as soon as i've worked out what i'm doing.

Thanks for the replies

Declan
Declan Heerey
Frequent Advisor

Re: Problem extending swap space

I have added the additional 4Gb of swap on /dev/vg00/lvol9 as this was a priority. I will mirror the lv when i locate my missing disk. I have added the new lvol to the /etc/fstab

Thanks for all the assistance

Points assigned
Declan Heerey
Frequent Advisor

Re: Problem extending swap space

I have managed to find the missing disk (i'd taken down the incorrect PV name) :o) and using the instructions provided have mirrored the swap volumn lvol9, sync the disks and added the lvol9 to /etc/fstab. All working. Thanks for all the help, all appreciated! I have allocated points but it is coming up as unassigned so pls let me know if they have not been received and i will reallocate.

Thanks again

Declan