Expand swap area with ubuntu 18.04 Initially, there was only 2GB, and when the memory was exhausted, the swap was exhausted and dropped, so I had to increase the swap.
Turn off swap. If there is data in the swap, it will take some time because it can be stored in memory.
$ sudo swapoff /swapfile
Overwrite existing swapfile with new size
$ sudo fallocate -l 32G /swapfile
Permission settings
$ sudo chmod 600 /swapfile
Initialize
$ sudo mkswap /swapfile
mkswap: /swapfile: warning: wiping old swap signature.
Setting up swapspace version 1, size = 32 GiB (34359734272 bytes)
no label, UUID=869d1f34-eec7-475e-b871-471e4d5fa9f8
Turn on swap
$ sudo swapon /swapfile
Verification
$ sudo swapon --show
NAME TYPE SIZE USED PRIO
/swapfile file 32G 0B -2
reference How do I get more swap files in Ubuntu 18.04? Create / extend swap file in Ubuntu 18.04 LTS
Recommended Posts