1834648 Members
2833 Online
110069 Solutions
New Discussion

How to extend /swap

 
Tarek
Super Advisor

How to extend /swap

Hi all..
i have to extend my /swap area...there are 3 gb of LVM unused..
how can i do??
19 REPLIES 19
Stefan Farrelly
Honored Contributor

Re: How to extend /swap


Extending your primary swap area isnt going to be easy, as it needs to be contiguous and in the first 2GB of your disk. This will be a long and tricky job.

Much easier to simply add another swap area, you can do this online without a reboot (first option above will need a reboot).

Simply create a new logical volume, to whatever size you need. Then add it to the /etc/fstab file;

/dev/vg00/lvolX / swap defaults 0 0

Then issue the command swapon -a
and your done. swapinfo -mt command will now show the new swap area activated.
Im from Palmerston North, New Zealand, but somehow ended up in London...
eran maor
Honored Contributor

Re: How to extend /swap

Hi

#lvcreate -L xxx /dev/vg00
insert in /etc/fstab:
/dev/vg00/lvolxx ... swap pri=2 0 0
#swapon -a
#swapinfo -mt (verify)

Try also with SAM.
love computers
Wieslaw Krajewski
Honored Contributor

Re: How to extend /swap

Hi,

You should definittely follow Stefan's advice.
But there is something I would like to add.
You can already have, beside primary swap, some extra swap in for example /dev/vg01/swaplv. If you want to extend this Lv you can use lvextend command, and then you must reboot your system.
Although it is much better to have a number of smaller swap areas instead of one huge swap area - performance reasons.

Rgds.
Permanent training makes master
Tarek
Super Advisor

Re: How to extend /swap

how can i create a new logical volume??
i'm not very expert in this..
Vincenzo Restuccia
Honored Contributor

Re: How to extend /swap

#lvcreate -L 1000 /dev/vg00 (1Gb,L is Mb)
insert in /etc/fstab:
/dev/vg00/lvolxx ... swap pri=2 0 0
#swapon -a (enabled secondary sap)
#swapinfo -mt (verify if your swap is enabled)
Or with SAM select disk and file system -> swap

Eran Moran not cut and paste my reply please !!!
eran maor
Honored Contributor

Re: How to extend /swap

no problem .
you are rigth
love computers
Tarek
Super Advisor

Re: How to extend /swap

I did:
lvcreate -L 1024 dev/vg00
swapon -a
and i added it in the /etc/fstab
/dev/vg00/lvol5 / swap defaults 0 0
but when i open sam - disk and file systems -
swap i have :
/dev/vg00/lvol2 device 1 4096 of 4096 now/on boot
/dev/vg00/lvol5 device 0 of 0 on boot
Is it ok or i have to do something else??

Thierry Poels_1
Honored Contributor

Re: How to extend /swap

Hi,
I would go for new swap space on another VG (or at least another disk within VG00) and give it the SAME priority (again for performance reasons).

Vincenzo: no copy & paste ?? Where did you get all your knowledge from?? you also got it (=copied it) from someone else, that's how you learn something! Remember: plagiarism is maybe the greatest compliment one can get.

regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Magdi KAMAL
Respected Contributor

Re: How to extend /swap

Hi Tarek,
You can add swap using the following commands:
1. # lvcreate -n lv... /dev/vg00
2. #lvextend -L /dev/vg00/lv... /dev/dsk/c1t1d0

NB: lv... stand for a name to logical volume.
c1t1d0 stand for the path name to the active disk.

Good luck
Vincenzo Restuccia
Honored Contributor

Re: How to extend /swap

Thierry Poels :One what is to learn gives someone
one what is the cut and paste.

Tarek see also http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xc4b4e7613948d5118fef0090279cd0f9,00.html
LB4
Valued Contributor

Re: How to extend /swap

The only way to extend your primary swap is to use ignite. If you interact with a restore using make_recovery you can change the primary swap size. The draw back is you must restore your system to do this.
Tarek
Super Advisor

Re: How to extend /swap

i have created it....
but i don't know if it's working or not....
nobody has answered the reply i made before...
now i have lvol5 associated with swap, but under swap (disks and FS) i have for the new swap:
Device File/Mount Directory: /dev/vgoo/lvol5
Type: Device
Current Priority:
Mbytes Available: 0 of 0
Enabled: on boot
In the /etc/fstab i put:
/dev/vg00/lvol5 / swap defaults 0 0
If i do swapinfo -mt i have:
TYPE MB AVAIL MB USED MB FREE PCT USED START/LIMIT MB RESERVE PRI NAME
dev 4096 0 4096 0% 0 - 1 /dev/vg00/lvol2
reserve - 62 -62
memory 1543 29 1514 2%
total 5639 91 5548 2% - 0 -
Is it working or not??
Please help...and why under Sam - disk and FS - swap i have 0 of 0 available??
Shannon Petry
Honored Contributor

Re: How to extend /swap

If you have never done this before, then use SAM
/usr/sbin/sam

go to disks->swap->actions->create

If you want better performance, set both priorities to the same number! If you have 2 swap chunks of 1GB each, and the same number, the system uses syncronous read/write to both...otherwise, the lowest number is filled first, then the second lowest number, etc....

As for people cutting and pasting, I see people here ranked as wizards that do exactly that, and paste URL's all day long.......Knowlege? not, smart enough to find knowlege? maybe!

Regards,
Shannon
Microsoft. When do you want a virus today?
Tarek
Super Advisor

Re: How to extend /swap

i have created the new lv.
lvcreate -L 1024 /dev/vg00
then i added in the /etc/fstab:
/dev/vg00/lvol5 / swap defaults 0 0
then
swapon -a and i have this message:
Enabling device paging on /dev/vg00/lvol5
swapon: The kernel tunable parameter "maxswapchunks" needs to be increased to add paging on device /dev/vg00/lvol5.
What should i do? Do i have to reboot the system?
Thierry Poels_1
Honored Contributor

Re: How to extend /swap

yep, to increase maxswapchunks you need to reboot.
But on the hand if you add swap space then swapchunks are added as much as possible, if you can live with the current swap space you can delay your reboot til the moment which suits you best. (in other words if maxswapchunks is just 10 swapchunks too low, there's little benefit in booting immediately)
good luck,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Tarek
Super Advisor

Re: How to extend /swap

Thanks Thierry...
i have rebooted the system but i don't think the new swap area is enabled.
It gives me the same error message of maxswapchunks that needs to be increased. Where can i increse it?? It's two days i'm trying all things that were written in this forum, but no one solved my problem.
What can i do?
Thierry Poels_1
Honored Contributor

Re: How to extend /swap

things to do ?? hire a good (as in expensive :) consultant, hmmm just kidding.

when you add the swapspace your system tells you how much your maxswapchunks need to be increased. You can change this kernel parameter through SAM (sorry not to have mentionned this explicitely before) and increase it to the number required (and take a nice margin for future expansion).
good luck,
Thierry.

All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Hamdy Al-Sebaey
Regular Advisor

Re: How to extend /swap

Hi Tarek,

Firstly, I agree with Stehpan,the best way is to create anew LV for the swap.
Secondly as long as you're new you do'nt ve enough experience so I recommend for you to use a save way to accomplish this task,the best way is to use SAM.

goodluck
Hamdy
Thanks for sharing knowledge

Re: How to extend /swap

under /stand you see a file by the name "system
edit the file and add following line
maxswapchunks 2048
now run these commands
mk_kernel
kmupdate ( if you are running 11.x and above) or copy /stand/build/vmunix_test /stand/vmunix
shutdown the system with -r -y now option
Strive for perfection