Skip to content

Instantly share code, notes, and snippets.

@mommi84 mommi84/
Created Sep 12, 2019

What would you like to do?
Add swap memory on Ubuntu
#!/usr/bin/env bash
# sudo ./ 4G
fallocate -l $1 /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
# print info
swapon --show
free -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.