KVM, XEN virtualization VPS adds swap partition

888u

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

OpenVZ architecture VPS is not applicable, it is only suitable for XEN and KVM architecture, but not all VPS hosting providers may allow you to add swap files.

1. Enter the directory

cd /var/

2. Obtain the SWAP file block to be added (here, we take 1GB as an example). This step may take some time, please wait patiently

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

You can also modify /etc/fstab in the above step and add /var/swapfile swap swap defaults 0 0

Recommended site searches: Hong Kong server rental, registration-free virtual space, foreign host shopping guide, website space domain name, online proxy server free web version, all-purpose virtual host, China domain name trading center, host domain name, registration-free, American host network,

KVM, XEN virtualization VPS adds swap partition

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