Linux partitions are LVM, and there are three phases to expand the hard disk: New Partition & mdash; new PV & mdash; expanded VG & mdash; expand a single LV hard disk. to divide it into multiple logical partitions, create a new partition. skip this step if you use the entire hard disk: 12345678910111213141
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 |