Last active
January 8, 2023 07:26
-
-
Save ChadBailey/3c90d861145660fa5e2d493b3c3a2ecd to your computer and use it in GitHub Desktop.
Adjust swap (page) file size Kubuntu 22.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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