Last update at :2024-06-13,Edit by888u
Today, Snail deployed a one-click package WEB environment in a VPS and found that the hard drive only had 2.5GB left. The hard drive of this machine itself was only 10GB, but if you think about it, the system would not occupy so much disk. Then look It should be caused by the built-in partitioning of the VPS into a 2GB SWAP swap partition when installing the one-click package. The memory of this VPS itself is 2GB. If it is divided into 2GB, it feels a bit large. After all, the disk occupancy is small now, and slightly larger data cannot be stored.
So Snail is going to delete the divided SWAP swap partition, or give it 512MB, at least as much as possible for disk use. Partitioning swap partitions is only possible in XEN and KVM architectures, so at the time of this article I was operating on this KVM architecture VPS host. (Here I first close the partition with swapoff -a, then delete the configuration file and delete the partition file before dividing the new partition)
First, check the current status
The current SWAP swap partition is 0, so we need to deploy it here.
Second, enter the directory deployment
cd /var/dd if=/dev/zero of=swapfile bs=1024 count=524288
Here I am going to give 512MB as SWAP. After all, the disk is insufficient. If we have enough disk, it will be fine if we make 2G-4GB. Just adjust the COUNT parameter above.
Third, create file/activate
/sbin/mkswap swapfile/sbin/swapon swapfile
Fourth, add to startup items
vi /etc/fstab
Open the file and add in the last line:
/var/swapfile swap swap defaults 0 0
Save and exit after adding.
Fifth, inspection
Here we can restart the server and then check to see if the swap partition has been added.
Here we can see that it has been added. In this way, the SWAP swap partition has been completed, so that I can set aside 1.5GB for the hard drive from the original 2GB swap partition.
Recommended site search: Korean independent server, virtual space purchase, US server rental, cloud virtual host, https proxy ip, free host server abroad, free virtual host of the Ministry of Industry and Information Technology filing system, Dongguan hosting,
发表评论