Skip to content

Instantly share code, notes, and snippets.

@rodrigopedra
Forked from Jeckerson/create-swap.sh
Created September 3, 2025 20:43
Show Gist options
  • Save rodrigopedra/0604f4965bf8edd1b225e92f4d9022be to your computer and use it in GitHub Desktop.
Save rodrigopedra/0604f4965bf8edd1b225e92f4d9022be to your computer and use it in GitHub Desktop.
Create swap file on Linux
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" | tee -a /etc/fstab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment