1

How to Set Swap Partition on 2GB of memory

Asked 5 months ago (Feb 15, 2022) in the field of Linux by Ray Ns

Hello, How can i Set Swap Partition on 2GB of memory on the Ubuntu 18 or Ubuntu 20 server.


Answers


0
Answered 5 months ago (Feb 15, 2022) by Eldernode Staff

For server with 2 GB of memory, it is recommended to set 2 GB (2048MB) swap partition to improve system performance.

 

sudo dd if=/dev/zero of=/swapfile count=2048 bs=1M
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile   none    swap    sw    0   0' | sudo tee -a /etc/fstab
free -m

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day