The document provides a guide on how to manually add a Swap partition in Debian 11 and Ubuntu 22.04
This article will guide you on how to manually add a Swap partition in Debian 11 and Ubuntu 22.04.
Preparation
First, check if your system already has a Swap partition:
free -m
or
swapon -s
If no result is returned or the column in shows , it means your system does not have a Swap partition.Swapfree -m0
Creating a SWAP Partition
We can use the command to create a 1GB Swap partition:fallocate
fallocate -l 1G /swapfile
If this command is not available, install the package:util-linux
apt-get install util-linux
Then, set the file permissions:
chmod 600 /swapfile
Activate the Swap partition:
mkswap /swapfile
swapon /swapfile
At this point, you can check if the Swap partition is active using the or command.swapon -sfree -m