Skip to content

Instantly share code, notes, and snippets.

@ChadBailey
Last active January 8, 2023 07:26
Show Gist options
  • Save ChadBailey/3c90d861145660fa5e2d493b3c3a2ecd to your computer and use it in GitHub Desktop.
Save ChadBailey/3c90d861145660fa5e2d493b3c3a2ecd to your computer and use it in GitHub Desktop.
Adjust swap (page) file size Kubuntu 22.04
#!/bin/sh
# First check to see that swap file is in use, and what size it is
free -h
sudo swapoff -a
ls -al /swapfile
# Too lazy to make a proper interface, just edit the "8GB" to preferred size
sudo fallocate -l 8G /swapfile
# Should now show new size
ls -al /swapfile
# Optional (it should still be 600 from before)
#sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Ensure fstab contains `/swapfile swap swap defaults 0 0` (space count doesn't matter, but do not use tabs)
sudo cat /etc/fstab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment