fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
If RAM = 4GB
Use swap = 4GB–8GB
If RAM = 8GB
Swap = 2GB–4GB is fine
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
If RAM = 4GB
Use swap = 4GB–8GB
If RAM = 8GB
Swap = 2GB–4GB is fine