1834020 Members
3127 Online
110063 Solutions
New Discussion

Add more swap space

 
SOLVED
Go to solution
Vito Sarducci
Regular Advisor

Add more swap space

I want to add more swap space. How do I accomplish this again? Please advise?

Vito
Lifes too short to stress out, Enjoy every day you have on earth!
6 REPLIES 6
Roger Baptiste
Honored Contributor
Solution

Re: Add more swap space

To create a swap logical volume, do the following:

1. Create a contiguous logical volume:

lvcreate -L size -C y /dev/vgX

2. Turn swap on in the logical volume:

swapon /dev/vgX/lvolY

IMPORTANT: The default priority for swap is "1". It is a recommended to have
all the swap devices set to the same priority.

3. Edit the /etc/fstab so that swap will be turned on at boot-up; add the
following line:

/dev/vgX/lvolY ... swap defaults 0 2
/dev/vg00/swap2 ... swap pri=1 0 0

or (to enable every swap definition in /etc/fstab, run swapon -a )


HTH
raj

Take it easy.
S.K. Chan
Honored Contributor

Re: Add more swap space

Assuming you want to add 800MB swap using extents available in vg00.

# lvcreate -L 800 -n swap2 -C y -r n /dev/vg00
==> create 800MB contigous lv called swap2 in vg00 with bad block reallocation turned off

# swapon -p 1 /dev/vg00/swap2
==> enable swap with priority 1.

# swapinfo -tam
==> check to see if added swap is enabled.

# vi /etc/fstab
....
/dev/vg00/swap2 ... swap pri=1 0 1
....
==> add entry in /etc/fstab file.

Ross Martin
Trusted Contributor

Re: Add more swap space

The following example shows how to add a swap device to
volume group /dev/vg00:

- As root type lvcreate -L 100 -C y -s y -r n /dev/vg00, which should return:

Logical volume "/dev/vg00/lvol10" has been successfully created with character device "/dev/vg00/rlvol10".
Logical volume "/dev/vg00/lvol10" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

* Note: -L 100 in the previous command specifies the size of the swap device

- Add "/dev/vg00/lvol10 ... swap pri=1 0 0" to the /etc/fstab file (where pri=1 is the priority of the swap)

- Type swapon -a

Hope that helps,

Ross Martin
HP

John Payne_2
Honored Contributor

Re: Add more swap space

The simplest way is to go into SAM -> Disks and filesystems -> Logical Volumes. Then do Actions -> Create. select Volume group, then define new logical volume. Pick a new lvol name (like lvol13 or whatever, but has to be unique in the volume group.) Enter the size you want, Then for 'usage', change to 'swap device'. Click add, then ok.

If your kernel is not prepared for the extra swap, you will have to walk through a couple of others steps and then reboot.

Hope it helps.

John
Spoon!!!!
Sanjay_6
Honored Contributor

Re: Add more swap space

Rose Lariviere
Occasional Advisor

Re: Add more swap space

Create logical volume.

lvcreate -L 500 -n swap -C n /dev/vg00

This command will create a 500 megabyte contigious logical volume called swap in
the vg00 volume group

You can enable the swap using swapon command.

swapon -p 2 /dev/vg00/swap

This command enables swap on the new "/dev/vg00/swap" volume that you just created, with a priority of 2. You may want to make that a priority 1 also.