创建swap
当swap内存不足时,可以用硬盘空间创建新的swap
[root@thankinglove sbin]# free -m total used free shared buffers cached Mem: 992 923 69 12 1 306 -/+ buffers/cache: 615 377 Swap: 0 0 0 [root@thankinglove sbin]# mkdir -p /opt/p_w_picpaths [root@thankinglove sbin]# rm -rf /opt/p_w_picpaths/swap [root@thankinglove sbin]# dd if=/dev/zero of=/opt/p_w_picpaths/swap bs=1024 count=2048000 2048000+0 records in 2048000+0 records out 2097152000 bytes (2.1 GB) copied, 41.3215 s, 50.8 MB/s [root@thankinglove sbin]# mkswap /opt/p_w_picpaths/swap Setting up swapspace version 1, size = 2047996 KiB no label, UUID=cb3463eb-fed5-448d-9727-506e874a5741 [root@thankinglove sbin]# swapon /opt/p_w_picpaths/swap swapon: /opt/p_w_picpaths/swap: insecure permissions 0644, 0600 suggested. [root@thankinglove sbin]# free -m total used free shared buffers cached Mem: 992 924 68 12 0 310 -/+ buffers/cache: 613 379 Swap: 1999 0 1999
当使用完毕后,可以关闭增加的swap
[root@thankinglove sbin]# swapoff /opt/p_w_picpaths/swap [root@thankinglove sbin]# rm -rf /opt/p_w_picpaths/swap
http://blog.csdn.net/taiyang1987912/article/details/41695895
转载于:https://blog.51cto.com/thankinglove/1791482