1) Login as "root" user.
2) Execute command "/sbin/swapon -s" (Remove quotations) and you will get current swap size details:
Sample OutPut:
[root@dev /]# /sbin/swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2064376 0 -1
3) Execute below command to create new swap space with 2048MB space
1048576+0 records in
1048576+0 records out
2147483648 bytes (2.1 GB) copied, 13.8048 seconds, 156 MB/s
2) Execute command "/sbin/swapon -s" (Remove quotations) and you will get current swap size details:
Sample OutPut:
[root@dev /]# /sbin/swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2064376 0 -1
3) Execute below command to create new swap space with 2048MB space
dd if=/dev/zero of=/home/swapfile bs=2048 count=1048576
Sample OutPut:
[root@dev /]# dd if=/dev/zero of=/home/swapfile bs=2048 count=10485761048576+0 records in
1048576+0 records out
2147483648 bytes (2.1 GB) copied, 13.8048 seconds, 156 MB/s
4) Execute below commands to create swap file:
/sbin/mkswap /home/swapfile
/sbin/swapon /home/swapfile
Now, Swap size is increased to 4 GB.
5) To check the swap space execute "/sbin/swapon -s"
Sample OutPut:
[root@dev /]# /sbin/swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2064376 0 -1
/home/swapfile file 2097144 0 -2
-- Siva Pokuri.