Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/weixin_39675633/article/details/80136913
How To Add Swap Space on Ubuntu
- 2G below to increase the space as an example, count represents the number of blocks is increased (Size = bs * count)
$ dd if =/dev/zero of=/root/swapfile bs=1M count=2048
- Formatting swap file
$ sudo mkswap /root/swapfile
- Enable swap file
$ sudo swapon /root/swapfile
- Save the above configuration, reboot still valid, you need to add the following line in the file / etc / fstab in
$ /root/swapfile swap swap defaults 0 0