Add swap space to vps of kvm

888u

Last update at :2024-05-16,Edit by888u

The default swap space for bricklayers is very small or not at all. Search the Internet for methods to add swap to vps here:

System:centos6

The following operations must be performed under the root user. First, create a partition and use the dd command such as: dd if=/dev/zero of=/home/swap bs=1024 count=1024000

This will create a partition file like /home/swap. The size of the file is 1024000 blocks, Generally, a block is 1K, so the space here is 1024M. Then turn this partition into a swap partition.

/sbin/mkswap -f /home/swap

Then activate the swap partition. Make it valid.

/sbin/swapon -f /home/swap

Now use the free -m command to check the memory and swap partition size, and find that 1024M of space has been added. However, after the computer restarted, it was found that the swap was still as large as before. The new swap did not start automatically and had to be started manually. Then we need to modify the vi /etc/fstab file and add the following line:

/home/swap swap swap defaults 0 0

You will find that the swap space has changed after your machine starts automatically, but the actual display of 1024m above is 1000m.

Recommended site searches: Hong Kong IP, best US server, independent IP space, network registration, ICP registration query, IP query, domain name registration website, Korean cn2 server, free mainland China space, cn domain name registration,

Add swap space to vps of kvm

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码