Mount extended Hard Disk Partitions using LVM in CentOS VPS
Linux partitions are LVM, and there are three phases to expand the hard disk: New partition -- New PV -- expand VG -- expand LV
To divide a single hard disk into multiple logical partitions, create a new partition. skip this step if you use the entire hard disk:
1234567891011121314151617
# Http://www.haiyun.mefdisk-l # view the partition to be mounted, usually/dev/xvdbfdisk/dev/xvdb Command (m for help ): n # New partition Command action e extended # extended Partition p primary partition (1-4) # primary Partition p # input p select new primary partition Partition number (1-4 ): 1 # primary Partition Number First cylinder (1-3263, default 1): # Start position of the partition. The default value is Last cylinder (1-3263, default 3263): # End position, by default, Command (m for help): t # specify the partition format Hex code (type L to list codes): 8e # Set it to LVMChanged system type of pa Rtition 1 to 8e (Linux LVM) Command (m for help): w # Save # The partition table has been altered! Quit # exit
Create a PV and expand it to VolGroup00
123456
Partprobe # re-read the Partition Table pvcreate/dev/xvdb1 # create a new PVvgscan # display the current VG # Reading all physical volumes. this may take a while... # Found volume group "VolGroup00" using metadata type lvm2 # VG name: VolGroup00vgextend VolGroup00/dev/xvdb1 # Extend PV to PG
Check the remaining number of PES in VolGroup00 to prepare the extended LV
1234
Vgdisplay # --- Volume group --- # VG Name VolGroup00 # VG Name # Free PE/Size 2553/79 .78 GB #2553 indicates the number of remaining PES
View the LV to be extended
123
Lvscan # list LV, when the capacity is large, the LV # ACTIVE '/dev/VolGroup00/logvol00' [10.53 GB] inherit # LV # ACTIVE'/dev/VolGroup00/LogVol01 '[ 256.00 MB] inherit
Expand LV
12
Lvresize-l + 2553/dev/VolGroup00/LogVol00 #2553 is the number of PES remaining in the VG resize2fs/dev/VolGroup00/LogVol00