1835075 Members
2069 Online
110073 Solutions
New Discussion

Swap/Paging Space

 
Preeti Khanna
Occasional Advisor

Swap/Paging Space

Hi
can anybody suggest how can i change my swap/paging space.

Thanks
Preeti
Mission Impossible
14 REPLIES 14
Stefan Farrelly
Honored Contributor

Re: Swap/Paging Space


if you need to add some more swap/paging space then create a new lvol in trhe normal way, set its size but dont newfs it. Then add an entry into /etc/fstab (see man fstab so see format) and then do a swapon -a command to see it activated instantly.. swapinfo -mt will show the new swap area already available.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Alex Glennie
Honored Contributor

Re: Swap/Paging Space

Extract from HP-UX 10.20 SAM kernel parameter configuration help.

Overview of Memory Paging Parameters
Configurable kernel parameters for memory paging enforce operating
rules and limits related to virtual memory (swap space). They fall into
the following categories:

Total System Swap Maximum swap space that can be allocated, system-
wide. Parameters include maxswapchunks and swchunk.

Device Swap Swap space allocated on hard disk devices. Parameters
include: nswapdev.

File System Swap Swap space allocated on mounted file systems.
Parameters include: allocate_fs_swapmap and nswapfs.

Cluster Client Swap Local swap space on cluster client to reduce
network data traffic. Parameters include:
page_text_to_local and remote_nfs_swap.

Pseudo-Swap Use of installed RAM as pseudo-swap, allowing virtual
memory space allocation beyond the limit of swap space on
disk devices. Parameters include: swapmem_on.

So for the above you could use SAM under hp-ux
CHRIS_ANORUO
Honored Contributor

Re: Swap/Paging Space

Go through SAM DIsks and filesystems swap and create a swap space from free disk space. Swap is contigously with a contiguous allocation is created better in this way. SAM runs the swapon command as well.
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
Dave Wherry
Esteemed Contributor

Re: Swap/Paging Space

As the others have said, use sam. It is the easiest way and handles all the tasks that need to be done.
Also, be aware of where you are going to create this new swap device. Try not to put more than one swap device on any one physical device. Spread them around.
Preeti Khanna
Occasional Advisor

Re: Swap/Paging Space

Hi
Thanks for Reply . Currently my System had 32GB of total Swap Space and I want to increase the swap space to 50GB.
Please go through the attached file.
Can I Increase lvswap in vg02 and vg03 . I had free space in vg02 and vg03.can i use lvextend command to increase the size.
or I have to create a new logical volume in this volume group to increase the swap space.

Please suggest

Thanks
Mission Impossible
Andy Monks
Honored Contributor

Re: Swap/Paging Space

50GB of swap is an awful lot. Are you sure you really require that much?

Also, your currently only using 2 of the 3 swap devices. This is due to the priority of 2 of them set to '1' and the other set to '2'. It therefore won't use the 3rd device swap, until the first 2 are full. The paging/swapping code, will balance I/O's between all the swap devices of the same priority, therefore changing them all to be the same priority can help.

As for increasing the size of the swap, you have a couple of choices :-

1. Add a new swap lvol. Putting swap on more physical disks can improve performance.

2. Increase the size using lvextend of 2 of the swap devices (you won't easily be able to increase /dev/vg00/lvol2).

To increase the others you can do :-

lvextend -L

Then reboot. The system will then see the new size after it's rebooted. You'll need to ensure that the kernel parameter 'maxswapchunks' is set high enough too (this is true for either method 1 or 2).


I would recommend a more swap devices, rather then increasing the size of the existing ones.
John Palmer
Honored Contributor

Re: Swap/Paging Space

Just an observation, but why do you want to increase the swap space? From your attached output from swapinfo, you were only using 28% of your 32Gb (about 9Gb) on what looks like a 4Gb RAM machine.

If you intend to actually use even the 32Gb of swap space that you have then I would have thought that performance would be terrible!

If you do an 'lvdisplay' of your swap volumes, you will see that they are set 'contiguous' (all swap volumes must have this property as well as Bad block relocation set to 'off'). This means that you can only extend your existing volumes if there are sufficient free disk extents right next to the existing volume.

If you really do want to increase your swap space then I would suggest creating another swap volume. Either use sam or the 'lvcreate' command with '-C y -r n' arguments.

Regards,
John
John Palmer
Honored Contributor

Re: Swap/Paging Space

Just an observation, but why do you want to increase the swap space? From your attached output from swapinfo, you were only using 28% of your 32Gb (about 9Gb) on what looks like a 4Gb RAM machine.

If you intend to actually use even the 32Gb of swap space that you have then I would have thought that performance would be terrible!

If you do an 'lvdisplay' of your swap volumes, you will see that they are set 'contiguous' (all swap volumes must have this property as well as Bad block relocation set to 'off'). This means that you can only extend your existing volumes if there are sufficient free disk extents right next to the existing volume.

If you really do want to increase your swap space then I would suggest creating another swap volume. Either use sam or the 'lvcreate' command with '-C y -r n' arguments.

Regards,
John
John Palmer
Honored Contributor

Re: Swap/Paging Space

Just an observation, but why do you want to increase the swap space? From your attached output from swapinfo, you were only using 28% of your 32Gb (about 9Gb) on what looks like a 4Gb RAM machine.

If you intend to actually use even the 32Gb of swap space that you have then I would have thought that performance would be terrible!

If you do an 'lvdisplay' of your swap volumes, you will see that they are set 'contiguous' (all swap volumes must have this property as well as Bad block relocation set to 'off'). This means that you can only extend your existing volumes if there are sufficient free disk extents right next to the existing volume.

If you really do want to increase your swap space then I would suggest creating another swap volume. Either use sam or the 'lvcreate' command with '-C y -r n' arguments.

Regards,
John
Andy Monks
Honored Contributor

Re: Swap/Paging Space

50GB of swap is an awful lot. Are you sure you really require that much?

Also, your currently only using 2 of the 3 swap devices. This is due to the priority of 2 of them set to '1' and the other set to '2'. It therefore won't use the 3rd device swap, until the first 2 are full. The paging/swapping code, will balance I/O's between all the swap devices of the same priority, therefore changing them all to be the same priority can help.

As for increasing the size of the swap, you have a couple of choices :-

1. Add a new swap lvol. Putting swap on more physical disks can improve performance.

2. Increase the size using lvextend of 2 of the swap devices (you won't easily be able to increase /dev/vg00/lvol2).

To increase the others you can do :-

lvextend -L

Then reboot. The system will then see the new size after it's rebooted. You'll need to ensure that the kernel parameter 'maxswapchunks' is set high enough too (this is true for either method 1 or 2).


I would recommend a more swap devices, rather then increasing the size of the existing ones.
John Palmer
Honored Contributor

Re: Swap/Paging Space

Just an observation, but why do you want to increase the swap space? From your attached output from swapinfo, you were only using 28% of your 32Gb (about 9Gb) on what looks like a 4Gb RAM machine.

If you intend to actually use even the 32Gb of swap space that you have then I would have thought that performance would be terrible!

If you do an 'lvdisplay' of your swap volumes, you will see that they are set 'contiguous' (all swap volumes must have this property as well as Bad block relocation set to 'off'). This means that you can only extend your existing volumes if there are sufficient free disk extents right next to the existing volume.

If you really do want to increase your swap space then I would suggest creating another swap volume. Either use sam or the 'lvcreate' command with '-C y -r n' arguments.

Regards,
John
James R. Ferguson
Acclaimed Contributor

Re: Swap/Paging Space

Hi:

I agree with John. Based on your swapinfo it doesn't look like you need more swapspace.

I would also suggest that if/when you increase or add more space, that you make the size of each space equal and set the swap priority the same. This will allow interleaving which will level I/O among the swap devices thereby improving performance.

...JRF...
Vincente Fernandes
Valued Contributor

Re: Swap/Paging Space

1. You need to comment out the 2 foll lines "/dev/vg02/lvswap & /dev/vg03/lvswap" from "fstab" file to disable swap space and reboot the server in single user mode.
Do an lvextend on vg02 & vg03 to increase the swap space to 50GB. Uncomment out the above lines from "fstab" and reboot the server.
2. You can also create another logical volume to increase swap space online and update fstab and use swapon to activate it.
For better performances and response in your case i suggest you have swap space created on individual seperate disks.
Vincente Fernandes
Valued Contributor

Re: Swap/Paging Space

Other then above you need to give the same priority to all the swap devices so that they can be equally utilised and get better performance.