How to Add Swap Space in CentOS 7: A Step-by-Step Guide

Create Swap File
dd if=/dev/zero of=/swapfile count=4096 bs=1MiB
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
Check Swap
swapon -s
free -h 
Make Swap File Permanent
echo /swapfile   swap    swap    sw  0   0 >> /etc/fstab

Leave a Reply