Penanganan "Lack of free swap space on Portal 6" dapat diketahui dengan menggunakan perintah linux sebagai berikut :
[root@portal ~]# free -h
total used free shared buffers cached
Mem: 4.7G 4.6G 34M 328K 676K 6.6M
-/+ buffers/cache: 4.6G 41M
Swap: 1.5G 1.5G 0B
Dari perintah linux diatas diketahui bahwa swap memori 0B, solusi yang dapat dilakukan ialah dengan cara menambah ukuran memori swap.
Berikut langkah-langkah dalam menambah memori swap di Linux CentOS :
- [root@portal1 ~]# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 1572860 1572860 -1 - [root@portal1 ~]# free -h
total used free shared buffers cached
Mem: 4.7G 4.6G 29M 328K 632K 6.2M
-/+ buffers/cache: 4.6G 36M
Swap: 1.5G 1.5G 0B - [root@portal1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
13G 1.3G 11G 11% /
tmpfs 3.0G 0 3.0G 0% /dev/shm
/dev/xvda1 477M 57M 395M 13% /boot
10.10.102.1:/mnt/data/vhost
527G 287G 240G 55% /etc/httpd/conf/vhost
10.10.102.1:/mnt/data/php_session
527G 287G 240G 55% /var/lib/php/session
10.10.102.1:/mnt/data/website - [root@portal1 ~]# ls -lh /swapfile
ls: cannot access /swapfile: No such file or directory - [root@portal1 /]# sudo fallocate -l 4G /swapfile
- [root@portal1 /]# ls -lh /swapfile
-rw-r--r-- 1 root root 4.0G Jun 16 14:41 /swapfile - [root@portal1 /]# sudo chmod 600 /swapfile
- [root@portal1 /]# ls -lh /swapfile
-rw------- 1 root root 4.0G Jun 16 14:41 /swapfile - [root@portal1 /]# sudo chmod 600 /swapfile
- [root@portal1 /]# ls -lh /swapfile
-rw------- 1 root root 4.0G Jun 16 14:41 /swapfile - [root@portal1 /]# sudo mkswap -f /swapfile
Setting up swapspace version 1, size = 4194300 KiB
no label, UUID=fd44055f-0713-458a-9e7b-6beaf2b5f044 - [root@portal1 /]# swapon /swapfile
- [root@portal1 /]# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 1572860 1572860 -1
/swapfile file 4194300 14808 -2 - [root@portal1 /]# free -m
total used free shared buffers cached
Mem: 4787 4760 26 0 0 12
-/+ buffers/cache: 4748 39
Swap: 5631 1551 4080 - Buat agar OS secara otomatis akan menggunakan swap file
/swapfile swap swap sw 0 0
Demikian Semoga Bermanfaat..