Search This Blog

Sunday, June 5, 2011

Increasing a Swap Space


Increasing Swap Space:
Dump devices are volumes on the disk that are used to hold the entire memory image when the system crashes. The cumulative size of all specified dump devices has to be some MB larger than the amount of memory in order to hold the entire core. To determine the current size of physical memory:

# dmesg | grep Physical
Physical:131072 KB ,lockable:96668 KB ,available:113536 KB

Increase the swap space in the server.

Create the logical volume for your swap:

# lvcreate -n lv_swap4 -l 128 -m 1 -C y -r n /dev/vg00

-l 128 (128 extent)
-C y contiguous file system
-r n bad block relocation must be disabled

 Verify the logical volume:

# lvdisplay /dev/vg00/lv_swap4

 Use SAM to declare your new secondary swap or use the command line:

# swapon /dev/vg00/lv_swap4

 To declare the swap space with priority 2

# swapon /dev/vg00/lv_swap4

Add the following entry in the /etc/fstab file: 
/dev/vg00/lv_swap4 null swap defaults 0 0

Checking the size of the swap:
#swapinfo -ta

Creating additional Swap Space:
# mkdir /dev/vg01
# mknod /dev/vg01/group c 64 0x010000
# pvcreate -f /dev/rdsk/c6t8d5
Physical volume "/dev/rdsk/c6t8d5" has been successfully created.
# vgcreate -s 64 /dev/vg01 /dev/dsk/c6t8d5
Volume group "/dev/vg01" has been successfully created.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf
# lvcreate -C y -D n -s y -r n -L 32768 /dev/vg01 
Logical volume "/dev/vg01/lvol1" has been successfully created with
character device "/dev/vg01/rlvol1".
Logical volume "/dev/vg01/lvol1" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf
# swapon -p 1 -t dev /dev/vg01/lvol1
swapon: The device /dev/vg01/lvol1 is a VxVM or LVM disk,
which prevents paging there.

Backout Plan

Remove the logical volume /dev/vg00/lv_swap4

# lvremove /dev/vg00/lv_swap4

Remove the following entry from the file /etc/fstab

#/dev/vg00/lv_swap4 null swap defaults 0 0

Host needs to be rebooted.

How to monitor the swap space ?

"swapinfo" command will show the statistics on device, LV and file system swaps.

To show only the device swap areas,
# swapinfo -d

To show only the file system swap areas,
# swapinfo -f

To show all the device and file system swaps in megabytes instead of kilebytes :
# swapinfo -m

To show all the device and file system swaps with a total details at the last line :

# swapinfo -t

No comments:

Post a Comment