suryadi / Add Linux Swap Space

Cloned from adierebel / Add Linux Swap Space

13 Apr 2018 at 09:13

Create swap file:
sudo fallocate -l 1G /swapfile
Update file permission:
sudo chmod 600 /swapfile
ls -lh /swapfile
Make swap and turn on:
sudo mkswap /swapfile
sudo swapon /swapfile
Check swap status:
free -h
Backup fstab:
sudo cp /etc/fstab /etc/fstab.bak
Add to fstab:
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Comments (0)