Last update at :2024-07-03,Edit by888u
Today, after deploying a one-click package WEB environment in a VPS, I found that the hard disk only has 2.5GB left. The hard disk of this machine itself is only 10GB, but thinking about it, the system will not occupy so much disk, and then see 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 I am going to delete the divided SWAP swap partition, or give it 512MB, or at least use as much as possible for the disk. 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, check
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: Hong Kong cloud server 10 yuan a year, US server defense, Hong Kong virtual host space, how much does it cost to rent a server for a year, registration website, independent IP space, cc domain name, foreign server, how to check the domain name registration number, Cloud server vps,
发表评论