[root@ncbsstd ~]# free -g
total used free shared buffers cached
Mem: 503 1 501 0 0 0
-/+ buffers/cache: 1 502
Swap: 0 0 0
[root@ncbsstd ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 197G 6.4G 181G 4% /
tmpfs 252G 0 252G 0% /dev/shm
/dev/mapper/mpathap1 976M 82M 828M 9% /boot
/dev/sdb3 59G 53M 56G 1% /tmp
/dev/sdb5 1.2T 5.4G 1.1T 1% /u01
/dev/mapper/mpathap2 1.8T 68M 1.7T 1% /u02
/dev/sdb2 99G 2.3G 92G 3% /var
The following steps show how to add 128GB of swap to our server:
[root@ncbsstd ~]# fallocate -l 128G /u01/swapfile
[root@ncbsstd ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 197G 6.4G 181G 4% /
tmpfs 252G 0 252G 0% /dev/shm
/dev/mapper/mpathap1 976M 82M 828M 9% /boot
/dev/sdb3 59G 53M 56G 1% /tmp
/dev/sdb5 1.2T 134G 940G 13% /u01
/dev/mapper/mpathap2 1.8T 68M 1.7T 1% /u02
/dev/sdb2 99G 2.3G 92G 3% /var
Format the swap file by entering the following command
[root@ncbsstd ~]# chmod 600 /u01/swapfile
[root@ncbsstd ~]#
[root@ncbsstd ~]# mkswap /u01/swapfile
mkswap: /u01/swapfile: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 134217724 KiB
no label, UUID=df1bbc77-ffe2-4572-a156-150251282dcb
[root@ncbsstd ~]#
Now use the swap space
[root@ncbsstd ~]# swapon /u01/swapfile
[root@ncbsstd ~]# free -g
total used free shared buffers cached
Mem: 503 1 501 0 0 0
-/+ buffers/cache: 1 502
Swap: 127 0 127
[root@ncbsstd ~]#
[root@ncbsstd ~]# free -h
total used free shared buffers cached
Mem: 503G 1.7G 501G 932K 38M 159M
-/+ buffers/cache: 1.5G 502G
Swap: 127G 0B 127G
[root@ncbsstd ~]#
[root@ncbsstd ~]# vim /etc/fstab
/u01/swapfile swap swap defaults 0 0
reboot the server and check again ............Thats it !!!!!!!!!!!!!!!!!
total used free shared buffers cached
Mem: 503 1 501 0 0 0
-/+ buffers/cache: 1 502
Swap: 0 0 0
[root@ncbsstd ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 197G 6.4G 181G 4% /
tmpfs 252G 0 252G 0% /dev/shm
/dev/mapper/mpathap1 976M 82M 828M 9% /boot
/dev/sdb3 59G 53M 56G 1% /tmp
/dev/sdb5 1.2T 5.4G 1.1T 1% /u01
/dev/mapper/mpathap2 1.8T 68M 1.7T 1% /u02
/dev/sdb2 99G 2.3G 92G 3% /var
The following steps show how to add 128GB of swap to our server:
[root@ncbsstd ~]# fallocate -l 128G /u01/swapfile
[root@ncbsstd ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 197G 6.4G 181G 4% /
tmpfs 252G 0 252G 0% /dev/shm
/dev/mapper/mpathap1 976M 82M 828M 9% /boot
/dev/sdb3 59G 53M 56G 1% /tmp
/dev/sdb5 1.2T 134G 940G 13% /u01
/dev/mapper/mpathap2 1.8T 68M 1.7T 1% /u02
/dev/sdb2 99G 2.3G 92G 3% /var
Format the swap file by entering the following command
[root@ncbsstd ~]# chmod 600 /u01/swapfile
[root@ncbsstd ~]#
[root@ncbsstd ~]# mkswap /u01/swapfile
mkswap: /u01/swapfile: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 134217724 KiB
no label, UUID=df1bbc77-ffe2-4572-a156-150251282dcb
[root@ncbsstd ~]#
Now use the swap space
[root@ncbsstd ~]# swapon /u01/swapfile
[root@ncbsstd ~]# free -g
total used free shared buffers cached
Mem: 503 1 501 0 0 0
-/+ buffers/cache: 1 502
Swap: 127 0 127
[root@ncbsstd ~]#
[root@ncbsstd ~]# free -h
total used free shared buffers cached
Mem: 503G 1.7G 501G 932K 38M 159M
-/+ buffers/cache: 1.5G 502G
Swap: 127G 0B 127G
[root@ncbsstd ~]#
[root@ncbsstd ~]# vim /etc/fstab
/u01/swapfile swap swap defaults 0 0
reboot the server and check again ............Thats it !!!!!!!!!!!!!!!!!