How To Add Swap on CentOS 7.2

Опубликовано: 28 Февраль 2025
на канале: NixInPix
734
4

Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available. In this guide, we will demonstrate how to add swap on Centos 7.2 server.

Commands:
swapon -s
free -m
df -h
sudo fallocate -l 2G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
swapon -s
free -m
sudo nano /etc/fstab

/swapfile swap swap sw 0 0

sudo nano /etc/sysctl.conf
vm.swappiness=10
vm.vfs_cache_pressure=50
----------------------

Music by dyalla -   / dyallas  


You can always Deploy an SSD cloud server in 55 seconds
with Digitalocean.
Anyone how use this link will receive $10 in hosting credit immediately after unlocking their account by adding a valid payment method.
Sign Up with this link
https://m.do.co/c/7b9082af029f