Tutorial method for complete Linux VPS mounting without using a hard disk

888u

Last update at :2024-06-27,Edit by888u

Including Snail, after getting a VPS, they often directly install the one-click installation package and then build a website. In fact, careful users will find that the size of the hard drive we purchased through the command is different from the hard drive we actually use. For example, the machine tested below by Snail had a 15G hard drive when purchased, but in actual use it only had 10G. So where did the remaining 5G go? Of course, if our 10G is enough, we can ignore the need to mount unused hard drives. If we are a person who pursues perfection, or there will be more data in the future, we should use the VPS tutorial method to mount unused hard drives to unused hard drives. The hard drive is incorporated.

Article Directory Hide

The first step is to check the current hard disk usage with the command

The second step is to check the usage status

The third step is to add partitions

The fourth step is to create physical volumes and group them

Step 5, check the physical volume and space status

Step 6, add a hard drive

Finally, check and confirm

The first step, command to check the current hard disk usage fdisk -l

Through testing, we have seen that among the machines tested by Snail, 10G can be used, but about 5G has not been allocated. If we need to reasonably and optimally utilize VPS hard disk resources, we need to use the unallocated The resources are mounted to be available.

The second step, check the usage status df -hal

We can see that of the available 10G or so hard drives, 1.3G has been used, and 9.3G has not been used.

The third step, add partitions fdisk /dev/xvdb

Use the above command to add a new partition, and then see the picture below or follow the command below (//for explanation)

n //New partition p //Main partition 4 //The 4th partition, according to the actual number of partitions, if there are already 2 partitions, then we enter 3 here and press Enter //The default is Enter // Default t //Specify partition format 8e //Partition format is LVMw //Save reboot //Restart VPS

After restarting, let’s check the hard disk partition status

See our newly added /dev/xvdb4 partition.

Step 4, create physical volumes and group them pvcreate /dev/xvdb4vgextend VolGroup00 /dev/xvdb4

Step 5, check the physical volume and space status vgdisplay

You can see that we can expand the 4.97G hard drive.

Step six, add a hard drive lvresize -L +4.95G /dev/VolGroup00/LogVol00

One thing needs to be noted here. We detected above that there is still 4.97G hard drive available, but we need to leave a little room, so I expanded the capacity to 4.95G here.

resize2fs /dev/VolGroup00/LogVol00

Dynamically expand partition size.

Finally, check and confirm

We can see that by purchasing a 15G VPS, the capacity is expanded from the original default allocated 10G to 15G, and the resources are fully utilized.

Recommended site search: virtual host rental, Hong Kong high-defense server, which Hong Kong space is better, Qingdao IP agency, overseas domain name registration, domain name query, what is needed for website registration, website space domain name, multi-IP station group server, free domain name space,

Tutorial method for complete Linux VPS mounting without using a hard disk

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