Scene:
linux6.4 virtual machines, configure 1 5G disks, do LVM, now expand the disk to 21G, and add the expanded space to the existing LVM group.
Steps:
1. Disk expansion on VMware (slightly)
2. See if the hardware is expanding successfully
Command: fdisk-l (root user)
------------------------------------------------------------------------------------------------
[email protected] ~]$ sudo fdisk-l
DISK/DEV/SDA: 21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000c82f5
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 1045 7875584 8e Linux LVM
disk/dev/mapper/vg_master-lv_root:7205 MB, 7205814272 bytes
255 heads, Sectors/track, 876 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
disk/dev/mapper/vg_master-lv_swap:855 MB, 855638016 bytes
255 heads, Sectors/track, 104 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
------------------------------------------------------------------------------------------------
The discovery has become 21.5G.
3, the extra space to partition.
Command: FDISK/DEV/SDA
650) this.width=650; "title=" Qq20160823100057.png "alt=" wkiom1e7rm7yt-seaack1mopfae622.png "src="/HTTP/ S2.51cto.com/wyfs02/m00/86/4d/wkiom1e7rm7yt-seaack1mopfae622.png "/>
Type P to view the number of partitions and get:
650) this.width=650; "title=" 1.png "alt=" wkiol1e7rrhwszlkaaaim3qb2we107.png-wh_50 "src=" Http://s2.51cto.com/wyfs02 /m00/86/4c/wkiol1e7rrhwszlkaaaim3qb2we107.png-wh_500x0-wm_3-wmp_4-s_1199218171.png "/>
The result is that we should add a partition number of 3 (Dev/sda1,dev/sda2 ...). Then it should be dev/sda3.
Type N, add a partition, and get:
650) this.width=650; "title=" 2.png "alt=" Wkiom1e7r4gijp9raabnuak-fv4912.png "src=" http://s5.51cto.com/wyfs02/M00/ 86/4d/wkiom1e7r4gijp9raabnuak-fv4912.png "/>
Type P, primary partition, and type 3 (number):
650) this.width=650; "title=" 3.png "alt=" Wkiol1e7shrbie52aafuhkxamcc162.png "src=" http://s3.51cto.com/wyfs02/M01/ 86/4d/wkiol1e7shrbie52aafuhkxamcc162.png "/>
default start and end sectors (type two enter)  
type T, modify the partition type to 8e:
650) this.width=650; "title=" 4.png "alt=" Wkiom1e7sobh61biaadcldzchms248.png "src=" http://s4.51cto.com/wyfs02/M00/ 86/4d/wkiom1e7sobh61biaadcldzchms248.png "/>
Type W, write the partition table, and then restart the system:
650) this.width=650; "title=" 5.png "alt=" Wkiom1e7sr6dqqshaahbc6hyqvg402.png "src=" http://s4.51cto.com/wyfs02/M01/ 86/4d/wkiom1e7sr6dqqshaahbc6hyqvg402.png "/>
4. Format the new partition
mkfs.ext4/dev/sda3 
.EXT4 is your own file system type and can be queried if you don't know it:
Parted/dev/sda
(parted)Print List
5, volume expansion, added into the LVM group:
Lvm> Pvcreate/dev/sda3 Initialize the partition just now
650) this.width=650; "title=" 6.png "alt=" Wkiol1e7sb2anxdjaabln3vgbps792.png "src=" http://s4.51cto.com/wyfs02/M01/ 86/4d/wkiol1e7sb2anxdjaabln3vgbps792.png "/>
Lvm> Vgextend Vg_master/dev/sda3 joins the initialized partition to the virtual volume Group Vg_master
Lvm>lvextend-l +12g/dev/vg_master/lv_root Extending the capacity of an existing volume
(You can also use this command to extend all remaining space to an existing LV)
lvm>lvextend-l +100%free /dev/vg_master/lv_root
650) this.width=650; "title=" 7.png "alt=" Wkiol1e7sgkr6dblaaeimjlv35e441.png "src=" http://s5.51cto.com/wyfs02/M02/ 86/4d/wkiol1e7sgkr6dblaaeimjlv35e441.png "/>
Lvm>pvdisplay Viewing volume capacity
650) this.width=650; "title=" 8.png "alt=" Wkiol1e7sk3srh2jaakuf0bdacw900.png "src=" http://s4.51cto.com/wyfs02/M00/ 86/4d/wkiol1e7sk3srh2jaakuf0bdacw900.png "/>
6. File System expansion
Resize2fs/dev/vg_master/lv_root
650) this.width=650; "title=" Qq20160823101935.png "alt=" wkiol1e7stewtsc2aalrxrg0zzq677.png "src="/HTTP/ S2.51cto.com/wyfs02/m00/86/4d/wkiol1e7stewtsc2aalrxrg0zzq677.png "/>
view Linux commands for file system types
commands that you can view without mounting:
1. File
[[email protected] dev]# file-s/dev/sda1
/dev/ Sda1:linux Rev 1.0 ext4 FileSystem data (extents) (huge files)
2.parted
[[email protected] dev]# PARTED/DEV/SDA
GNU parted 1.8.8
Using/dev/sda
Welcome to GNU parted! Type ' help ' to view a list of commands.
(parted) print
Model:vmware, VMware Virtual S (SCSI)
DISK/DEV/SDA:21.5GB
Sector size (logical/physical): 512b/512b
Partition table:msdos
number start end Size type File system Flags
1 32.3kb 206mb 206mb primary ext3 boot
2 206mb 21.5gb 21.3gb primary LVM
3.fdisk
[Email protected] dev]# fdisk-l/DEV/SDA
disk/dev/sda:21.4 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Disk Identifier:0x0007c1e8
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 200781 Linux
/dev/sda2 2610 20764012+ 8e Linux LVM
commands that need to be mounted for viewing:
1.mount
[email protected] dev]# mount
/dev/mapper/volgroup00-logvol00 on/type ext3 (rw)
/proc on/proc type proc (rw)
Sysfs On/sys type SYSFS (rw)
Devpts on/dev/pts type devpts (rw,gid=5,mode=620)
/DEV/SDA1 on/boot type ext3 (rw)
Tmpfs ON/DEV/SHM type TMPFS (rw)
None On/proc/sys/fs/binfmt_misc type Binfmt_misc (rw)
Sunrpc on/var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
2.df
[Email protected] dev]# df-t
Filesystem Type 1k-blocks used Available use% mounted on
/dev/mapper/volgroup00-logvol00
Ext3 18320140 3426724 13962808 20%/
/DEV/SDA1 ext3 194442 13480 170923 8%/boot
Tmpfs tmpfs 516908 0 516908 0%/dev/shm
3.stat
[[email protected]/]# Stat-f bin
File: "Bin"
id:3ef5d5f4a8cc1340 namelen:255 TYPE:EXT2/EXT3
Block size:4096 fundamental block size:4096
blocks:total:4580035 free:3723354 available:3490702
inodes:total:1163264 free:1044678
This article from "I am still Alive" blog, reproduced please contact the author!
Capacity for Linux virtual machine disks.