Blog Paldi

Ubuntu one liner swap

# change 2G to how many GB of swap you want

fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon -s
echo "/swapfile swap swap sw 0 0" >> /etc/fstab

Verify swap memory is added:

free -m

Posted

in

by

Tags: