Skip to content

Instantly share code, notes, and snippets.

@chonz0
Last active June 7, 2018 14:56
Show Gist options
  • Save chonz0/88c383360a4d129d5f94a36fd7be9a33 to your computer and use it in GitHub Desktop.
Save chonz0/88c383360a4d129d5f94a36fd7be9a33 to your computer and use it in GitHub Desktop.
Script for create swap partition
# How-to:
# curl -L https://gist.githubusercontent.com/chonz0/88c383360a4d129d5f94a36fd7be9a33/raw/26d71f46f4491fd9b5354a4db24f21007bbdc198/create_swap.sh | sh
#
# Inspired on digital ocean article https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
# Source: https://github.com/feliperuhland/ubuntu-swap
#!/bin/sh
set -e
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment