Skip to content

Instantly share code, notes, and snippets.

@nair-ayush
Created April 4, 2019 05:40
Show Gist options
  • Save nair-ayush/fdf1a731bcd72ba7054badce247d73ee to your computer and use it in GitHub Desktop.
Save nair-ayush/fdf1a731bcd72ba7054badce247d73ee to your computer and use it in GitHub Desktop.
Change swap space from Ubuntu 17.04 onwards
# Swap is a special area on your computer, which the operating system can use as additional RAM.
# Starting with Ubuntu 17.04, the swap partition was replaced by a swap file.
# The main advantage of the swap file is easy resizing.
# We’ll extend the swap space available in the /swapfile to 8 GB.
# Turn off all swap processes
sudo swapoff -a
# Resize the swap
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
# if = input file
# of = output file
# bs = block size
# count = multiplier of blocks
# Make the file usable as swap
sudo mkswap /swapfile
# Activate the swap file
sudo swapon /swapfile
# Check the amount of swap available
grep SwapTotal /proc/meminfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment