![Adding swap to a CentOS 7 machine](https://code.trev.id.au/wp-content/uploads/2024/03/DALL·E-2024-03-07-13.07.36-A-person-with-short-brown-hair-and-wearing-glasses-is-working-intently-at-a-computer-in-a-tech-oriented-office-environment.-On-the-computer-screen.jpg)
CentOS 7 add swap
Adding swap to a CentOS 7 AWS virtual machine
This is the steps for adding swap space to an CentOS 7 server.
dd if=/dev/zero of=/swapfile count=2048 bs=1MiB chmod 600 /swapfile chown root. /swapfile mkswap /swapfile swapon /swapfile echo "/swapfile swap swap sw 0 0" >> /etc/fstab
Check to make sure it created correctly
swapon -s
That’s it
This note was written testing against the following image:
uname -a: Linux s17.iotau.io 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux