linux添加虚拟内存解决swap空间不足问题
增加一个SWAP文件:
1. 查看当前虚拟内存
[root@ora11gr2 ~]# free -m
total used free shared buffers cachedMem: 2026 217 1809 0 11 126
-/+ buffers/cache: 78 1947
Swap: 2047 0 2047
[root@ora11gr2 ~]#
[root@ora11gr2 ~]#
[root@ora11gr2 mapper]# lltotal 0
crw------- 1 root root 10, 63 Mar 19 00:11 control
brw-rw---- 1 root disk 253, 0 Mar 19 00:11 VolGroup00-LogVol00
brw-rw---- 1 root disk 253, 1 Mar 19 00:11 VolGroup00-LogVol01
[root@ora11gr2 mapper]#
[root@ora11gr2 mapper]#
2. 将当前swap空间由2047mb增加到3047mb 新增一个1024mb 的swap 文件
1024000+0 records in
1024000+0 records out
1048576000 bytes (1.0 GB) copied, 29.5369 seconds, 35.5 MB/s
3.执行以下命令增加并启用虚拟内存
[root@ora11gr2 mapper]# mkswap /home/swap
Setting up swapspace version 1, size = 1048571 kB[root@ora11gr2 mapper]# swapon /home/swap
[root@ora11gr2 mapper]# cd /home/
[root@ora11gr2 home]# ll
total 1025008
drwx------ 3 oracle oinstall 4096 Mar 18 23:49 oracle
-rw-r--r-- 1 root root 1048576000 Mar 19 00:14 swap
[root@ora11gr2 home]# free -m
total used free shared buffers cached
Mem: 2026 1232 793 0 13 1127
-/+ buffers/cache: 92 1934
Swap: 3047 0 3047