How to increase swap under linux swap partition

That exchange swap partition, similar to the windows virtual memory function, is the allocation of a block of space on the hard disk used as virtual memory. swap are usually installed in the system hard disk partition setting here is to explore what the system has been installed, the extension methods swap partition. Now we come to the next how the increase in the installed linux swap swap partition. there are two ways to increase the swap partition, one is the new partition as swap, the other is on disk create a large file to make swap. 1. the new swap partition extended if there is a new partition / dev / sda3, we use it to make swap.
# swapon -s                --查看当前swap情况
# mkswap /dev/sda3
# swapon /dev/sda3
# swapon -s
# vi /etc/fstab
/dev/sda3   swap   swap  defaults  0  0    --添加开机自动挂载
2. Large swap file extension
# cd /var
# dd if=/dev/zero of=file bs=1M count=1000       --生成1G的大文件
# mkswap file
# swapon file
# swapon -s
# vi /etc/fstab
/var/file   swap   swap   defaults  0   0
Conclusion: In a production environment, it seldom encountered in the need to increase the swap partition linux swap things, someday encounter this problem is basically to re-Baidu, or you can also Add this content: in linux how to increase swap swap http://www.ttlsa.com/html/1691.html

Reproduced in: https: //my.oschina.net/766/blog/211476

Guess you like

Origin blog.csdn.net/weixin_33979203/article/details/91547088