Simple Steps to Add SWAP to VPS

888u

Last update at :2024-04-29,Edit by888u

There is nothing to write about. Let’s talk about how small memory VPS solves the problem of insufficient memory. Sometimes when we buy a VPS with small memory, we may need to add some swap to the VPS in order to maximize its potential, or in special circumstances when the memory is insufficient and we have to resort to swap, we may think of adding swap to solve the temporary problem. Problem, especially now that SSD hard drives are more popular, the effect of adding swap is still obvious. Here is a brief talk about how to add swap. This method is only applicable to XEN and KVM VPS and does not apply to openvz.

1. Enter the directory

cd /var/

2. Obtain the SWAP file block to be added (here, 1GB is taken as an example)

dd if=/dev/zero of=swapfile bs=1024 count=1038336

3. Create SWAP file

/sbin/mkswap swapfile

4. Activate SWAP file

/sbin/swapon swapfile

5. Check whether the SWAP information is correct

/sbin/swapon –s

6. Add to the fstab file to start automatically when the system boots

echo “/var/swapfile swap swap defaults 0 0″ >>/etc/fstab

It’s that simple, then free -m to see if it really increases?

Recommended site searches: website registration, US server, US vps host, cm domain name registration, dynamic ip dial-up server, how to check ip, registration number query, mainland China space, domain name space purchase ip168,

Simple Steps to Add SWAP to VPS

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