Focus on cloud service provider activities
Notes on website operation and maintenance

Linux VPS ECS Adding Swap Partitions Tutorial

Due to the insufficient memory of the server, we may make up for it by adding the swap partition SWAP. Here we record how to add.

 cd /var/dd if=/dev/zero of=swapfile bs=1024 count=524288

Here I am going to give 512MB as SWAP. After all, there are not enough disks. If we have enough disks, we can do 2G-4GB. Just adjust the COUNT parameter above.

 /sbin/mkswap swapfile/sbin/swapon swapfile

Here Lao Zuo (laozuo. org) creates the file first.

Add to Startup Item

 vi /etc/fstab

Open the file, and then add:

 /var/swapfile swap swap defaults 0 0

Save and exit after adding.

Finally, we can restart the server, and then check whether the swap partition has been added.

Vote for you
Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » Linux VPS ECS Adding Swap Partitions Tutorial