Applies to: RHEL-family Linux — RHEL 6–10 / Rocky Linux 8–10 / AlmaLinux 8–10 / CentOS 6–8 / CentOS Stream 8–10
Linux can use swap when physical memory is under pressure. Swap can be provided by a dedicated partition, an LVM logical volume, or a swap file.
The original version of this article was written for RHEL 6 and CentOS 6. The same core swap-management commands are also used on current RHEL, Rocky Linux, AlmaLinux, and CentOS releases, so the procedure below has been updated while keeping the older versions in scope.

In This Article
- 1. Check Current Swap Space
- 2. Create a Swap Partition
- 3. Initialize the Partition as Swap
- 4. Add the Swap Partition to /etc/fstab
- 5. Activate and Verify Swap
- 6. Key Takeaways
1. Check Current Swap Space
Start by checking the active swap devices and current memory usage:
cat /proc/swaps
free -h
These commands work across both older and current RHEL releases. They are also useful after the change to confirm that the new swap space is active.
2. Create a Swap Partition
Create a dedicated partition with a partitioning tool such as fdisk or parted. The example below assumes the new partition is /dev/sdb2.
A reboot is not automatically required just because a new swap partition was created. If the kernel cannot reread the changed partition table because the disk is in use, a reboot may be required before continuing.
3. Initialize the Partition as Swap
Initialize the partition for swap:
mkswap /dev/sdb2
Then get its UUID:
blkid /dev/sdb2
Using the UUID in /etc/fstab is preferable to depending on a device name that could change.
4. Add the Swap Partition to /etc/fstab
Add the swap partition to /etc/fstab using the UUID returned by blkid:
UUID=8bced662-e967-4861-9bac-6df8957b3eb5 none swap defaults 0 0
Replace the example UUID with the value from your system.
On RHEL 7 and later, reload the systemd mount-unit configuration after changing /etc/fstab:
systemctl daemon-reload
RHEL 6 does not use systemd, so this step does not apply there.
5. Activate and Verify Swap
Activate swap entries from /etc/fstab:
swapon -a
Then verify the result:
cat /proc/swaps
free -h
If the new partition appears in /proc/swaps and the total swap value has increased, the configuration is active.
6. Key Takeaways
- The same basic swap-partition workflow remains valid from RHEL 6 through current RHEL releases.
- Use mkswap to initialize the partition and swapon to activate it.
- Use a UUID in /etc/fstab when possible.
- A reboot is only required when the operating system cannot use the new partition without one.
- Use systemctl daemon-reload after editing /etc/fstab on RHEL 7 and later.
References
- Red Hat – Getting started with swap in RHEL 10
- Red Hat – RHEL 7 Storage Administration Guide
- Red Hat – RHEL 6 Storage Administration Guide

Cloud and infrastructure professional with nearly two decades of experience in enterprise IT environments, spanning public cloud, private cloud, and hybrid architectures.