Focus on cloud service provider activities
Notes on website operation and maintenance

Complete Linux VPS mounting without hard disk tutorial method

Lao Zuo also often hangs up the one click installation package directly after getting the VPS to set up a website for use. In fact, careful users will find that the size of the hard disk we buy is not the same as the size of the hard disk we actually use. For example, the machine tested by Lao Zuo was 15G when it was purchased, but only 10G when it was actually used, Then where is 5G left? Of course, if we have enough 10G, we can also ignore the unused hard disks that do not need to be attached. If we are a perfectionist, or have more data in the future, we should adopt the VPS attachment of unused hard disks tutorial method to incorporate the unused hard disks.

Step 1: Command to check the current hard disk usage

 fdisk -l

 Complete Linux VPS mounting without hard disk tutorial method

Through the inspection, we can see that among the machines tested by Lao Zuo, 10G is usable, and about 5G is not allocated. If we need to make rational and optimal use of VPS hard disk resources, we need to attach the unassigned resources to available.

Step 2: View the usage status

 df -hal

 guazai-2

We can see that in the available 10G hard disk, 1.3G has been used, and 9.3G has not been used.

Step 3: Add partitions

 fdisk /dev/xvdb

Use the above command to add a new partition, and then look at the following figure or follow the command below (//for explanation)

N//Create a new partition
P//Primary partition
4//The fourth partition, according to the actual number of partitions, if there are two partitions, then we will enter 3
Enter//Enter default
Enter//Default
T//Specify the partition format
8e//The partition format is LVM
W//Save
Reboot//Restart VPS

 guazai-3

After reboot, let's check the hard disk partition

 guazai-4

See our new/dev/xvdb4 partition.

Step 4: Create physical volumes and group them

 pvcreate /dev/xvdb4 vgextend VolGroup00 /dev/xvdb4

 guazai-5

Step 5: Check the physical volume and space

 vgdisplay

 guazai-6

We can see that we can expand the capacity of 4.97G hard disk.

Step 6: Add a hard disk

 lvresize -L +4.95G /dev/VolGroup00/LogVol00

One thing to note here is that we have detected that 4.97G hard disk is still free, but we need to leave some room for it, so I will expand the capacity of 4.95G.

resize2fs /dev/VolGroup00/LogVol00

Dynamic resizing partition size.

Finally, check and confirm

 guazai-7

We can see that by purchasing 15G VPS, the original default allocation of 10G is expanded to 15G, and resources are reasonably fully utilized.

Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( four )
Do not reprint without permission: Lao Zuo's Notes » Complete Linux VPS mounting without hard disk tutorial method


Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge