Sunday, December 30, 2007

Extend swap space

You had change the amount of memory of the guest OS, or added some more RAM, the swap swap space should be updated.
I followed the below procedure.
Check the current swap space and mount points :
[root@orion:/root] ()$ swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2031608 0 -1
[root@orion:/root] ()$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
141G 8.4G 126G 7% /
/dev/sda1 99M 13M 82M 14% /boot
none 1.3G 0 1.3G 0% /dev/shm
192.168.1.11:/nfs/peoplesoftcd
97G 60G 37G 62% /nfs/software/peoplesoft
192.168.1.11:/nfs/oraclecd
97G 60G 37G 62% /nfs/software/oracle

Create a new file to receive extra swap space (1Gb more) :
[root@orion:/root] ()$ dd if=/dev/zero of=/extraswap bs=1M count=1024
1024+0 records in
1024+0 records out

Make the file as swap :
[root@orion:/root] ()$ mkswap /extraswap
Setting up swapspace version 1, size = 1073737 kB

Turn on the file as swap :
[root@orion:/root] ()$ swapon /extraswap

Check the new swap space and mount points (new file has been added) :
[root@orion:/root] ()$ swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2031608 0 -1
/extraswap file 1048568 0 -2
[root@orion:/root] ()$

To take in account the change on the next reboot, add the line /extraswap...
[root@orion:/root] ()$ more /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/extraswap none swap sw 0 0
# Beginning of the block added by the VMware software
.host:/ /mnt/hgfs vmhgfs defaults,ttl=5 0 0
# End of the block added by the VMware software
192.168.1.11:/nfs/peoplesoftcd /nfs/software/peoplesoft nfs rw,vers=2 0 0
192.168.1.11:/nfs/oraclecd /nfs/software/oracle nfs rw,vers=2 0 0
/dev/hdc /media/cdrom auto pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
/dev/fd0 /media/floppy auto pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
[root@orion:/root] ()$

Enjoy,

No comments: