The XEN architecture VPS generally provides a capacity of no less than 10 Gb, but most VPS Based on the Xensystem panel are mounted with 10 Gb hard disks by default (the first disk), and the remaining capacity (the second disk) you need to manually mount it to expand the default 10 Gb capacity.
We recommend that you operate on the new system. If the system already has data, we recommend that you back up the data first to prevent data loss caused by mounting errors.
This tutorial applies to CentOS 6 series. For CentOS 5 Series, see Xen Linux VPS hard disk volume group mounting tutorial.
1. view the current hard disk status
Fdisk-l
For example:
Here, "Disk/dev/xvdb: 21.5 GB" indicates that the second virtual hard Disk has 2 GB capacity, "/dev/mapper/vg_501153278-lv_root: "9135 MB" indicates that "/" is allocated 9135 MB (on the first virtual disk ).
Ii. format the second disk as an LVM Partition
Mount/dev/xvdb (second disk) and overwrite the capacity to the Linux system "/" directory. You need to format the second disk as an LVM partition first.
fdisk /dev/xvdb
Run the preceding command in SSH and then perform the following operations:
Command (m for help): n # create a partition Command action e extended p primary Partition (1-4) p # Set partition number (1-4) for the primary Partition ): 1 # primary Partition Number First cylinder (1-2610, default 1): 1 # Start sector (Press enter directly) Using default value 1 Last cylinder, + cylinders or + size {K, m, G} (1-2610, default 2610): 2610 Using default value 2610 # End sector (Press enter directly) Command (m for help ): t # specify the partition type Selected partition 1 # select partition 1 Hex code (type L to list codes): 8e # 8e is LVM Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): w # Save The partition table has been altered! Calling ioctl () to re-read partition table. Syncing disks.
3. View volume groups
vgdisplay
Run the preceding command in SSH to view the current PV and record "VG Name": vg_501153278, as shown in.
4. Add a volume group
1. Create the just-created LVM as PV
pvcreate /dev/xvdb1
Run the preceding commands by Using SSH.
2. Add a volume group
vgextend vg_501153278 /dev/xvdb1
Run the preceding command by Using SSH, enter the group Name (Vg Name) and the corresponding sub-drive number (/dev/xvdb1), and press enter to run the command.
3. View idle volume groups
vgdisplay
Run the preceding command again to record the value in "Free PE/Size": 5118.
V. Extended Disk
1. Expand the LV size
lvresize -l +5118 /dev/mapper/vg_501153278-lv_root
Run the preceding command in SSH, replace "+ 5118" with the value in "Free PE/Size", and replace "vg_501153278" with the Name of "VG Name.
2. Reset the size (to make it take effect)
resize2fs /dev/mapper/vg_501153278-lv_root
Run the preceding command in SSH to extend the format to make it take effect. For example.
Conclusion:
The principle of mounting a volume group is to virtualize the two disks into one hard disk through the volume group. When the first hard disk is insufficient, data is directly written to the second hard disk.