1. 查看当前分区情况
[root@bogon ORACLE]# free -m
total used free shared buffers cached
Mem: 1861 1763 98 30 162 73
-/+ buffers/cache: 1526 334
Swap: 2047 624 1423
2. 增加 swap 大小, 2G 左右
[root@bogon ORACLE]# dd if=/dev/zero of=/var/swap bs=1024 count=2048000
记录了2048000+0 的读入
记录了2048000+0 的写出
2097152000字节(2.1 GB)已复制,18.4418 秒,114 MB/秒
3. 设置交换文件
[root@bogon ORACLE]# mkswap /var/swap
mkswap: /var/swap: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 2047996 KiB
no label, UUID=5258d5c0-9b75-4380-8b94-0b04f336294d
[root@bogon ORACLE]# swapon /var/swap
[root@bogon ORACLE]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Dec 21 08:43:36 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=b5845b95-3407-4fc6-8c18-d6037a3e6edd / ext4 defaults 1 1
UUID=4646c812-a919-4969-be4c-ebcc3fa32795 /boot ext4 defaults 1 2
UUID=5f08ac8b-91d6-4bce-b153-534a93b81225 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults,size=1024m 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
swap /var/swap swap defaults 0 0
[root@bogon ORACLE]# swapoff /var/swap
[root@bogon ORACLE]# rm /var/swap