recettes/Homelab/Increase Linux Swap file size.md
gribse ecdfa2f7c4 Squashed 'temp-repo/' content from commit 6688605
git-subtree-dir: temp-repo
git-subtree-split: 6688605ad41f49d1eccead8d29421c658cad0100
2025-10-06 19:14:58 +02:00

1,009 B
Executable file

type date maturity
ressource 2025-03-06T10:13 graine

To increase the size of your swap file on Linux Mint, follow these steps:

Look how much swap you currently have

free -h

Turn off the current swap file

sudo swapoff /swapfile

Resize the swap file

Replace XG with the desired new size (e.g., 4G for 4 GB):

sudo fallocate -l XG /swapfile

If fallocate is not supported, use:

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

(for 4 GB, adjust count accordingly)

Set the correct permissions

sudo chmod 600 /swapfile

Format the swap file

sudo mkswap /swapfile

Enable the new swap file

sudo swapon /swapfile

Verify swap space

free -h

Make it permanent

Ensure the swap file is reactivated on reboot by adding this line to /etc/fstab:

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Your swap size is now increased.

Sources

ChatGPT