当前swap是5951M,创建一个512M的空文件
[root@www.linuxidc.com ~]# free -m
total used free shared buffers cached
Mem: 3947 793 3154 0 15 367
-/+ buffers/cache: 410 3537
Swap: 5951 651 5300
[root@www.linuxidc.com ~]#
[root@www.linuxidc.com ~]# dd if=/dev/zero of=/swap_mount bs=1024 count=524288
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 1.49614 seconds, 359 MB/s
[root@www.linuxidc.com ~]#
[root@www.linuxidc.com ~]# ls -h /swap_mount
/swap_mount
[root@www.linuxidc.com ~]# ls -hl /swap_mount
-rw-r–r– 1 root root 512M Jan 24 14:43 /swap_mount
把swap_mount挂载到swap上
[root@www.linuxidc.com ~]# mkswap /swap_mount
Setting up swapspace version 1, size = 536866 kB
[root@www.linuxidc.com ~]# swapon /swap_mount
[root@www.linuxidc.com ~]#
[root@www.linuxidc.com ~]# free -m
total used free shared buffers cached
Mem: 3947 1317 2630 0 16 885
-/+ buffers/cache: 415 3532
Swap: 6463 651 5812
[root@www.linuxidc.com ~]#
添加到开机自动挂载
[root@www.linuxidc.com ~]# echo “/swap_mount swap swap defaults 0 0” >> /etc/fstab
[root@www.linuxidc.com ~]# cat /etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/swap_mount swap swap defaults 0 0