查看VG
[root@DS-VM-LinuxEA ~]# vgs
VG #PV #LV #SN Attr VSize VFree
DTVG 1 2 0 wz--n- 14.50g 0
[root@DS-VM-LinuxEA ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root DTVG -wi-ao---- 12.50g
swap DTVG -wi-ao---- 2.00g
创建lvm
[root@DS-VM-LinuxEA ~]# parted /dev/xvda
GNU Parted 3.1
使用 /dev/xvda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system 标志
32.3kB 1049kB 1016kB Free Space
1 1049kB 525MB 524MB primary xfs 启动
2 525MB 16.1GB 15.6GB primary lvm
16.1GB 85.9GB 69.8GB Free Space
(parted) mkpart
分区类型? primary/主分区/extended/扩展分区? extended
起始点? 16.1GB
结束点? 85.9GB
(parted) print
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system 标志
1 1049kB 525MB 524MB primary xfs 启动
2 525MB 16.1GB 15.6GB primary lvm
3 16.1GB 85.9GB 69.8GB extended lba
(parted) mkpart
分区类型? primary/主分区/logical/逻辑分区? logical
文件系统类型? [ext2]? xfs
起始点? 16.1GB
结束点? 85.9GB
(parted) t
分区编号? 5
Flag to Invert? lvm
(parted) print
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system 标志
1 1049kB 525MB 524MB primary xfs 启动
2 525MB 16.1GB 15.6GB primary lvm
3 16.1GB 85.9GB 69.8GB extended lba
5 16.1GB 85.9GB 69.8GB logical lvm
(parted) w
align-check TYPE N check partition N for TYPE(min|opt) alignment
help [COMMAND] print general help, or help on COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition table)
mkpart PART-TYPE [FS-TYPE] START END make a partition
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition
quit exit program display the version number and copyright information of GNU Parted
(parted) quit
信息: You may need to update /etc/fstab.
[root@DS-VM-LinuxEA ~]# pvcreate /dev/xvda5
Physical volume "/dev/xvda5" successfully created.
[root@DS-VM-LinuxEA ~]# vgextend DTVG /dev/xvda5
Volume group "DTVG" successfully extended
[root@DS-VM-LinuxEA ~]# vgdisplay
--- Volume group ---
VG Name DTVG
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 79.50 GiB
PE Size 4.00 MiB
Total PE 20353
Alloc PE / Size 3711 / 14.50 GiB
Free PE / Size 16642 / 65.01 GiB
VG UUID 5ZQ2hP-K9av-en3J-SWvu-skwa-x3Nt-uHrSX2
[root@DS-VM-LinuxEA ~]# vgdisplay |grep Free
Free PE / Size 16642 / 65.01 GiB
[root@DS-VM-LinuxEA ~]# lvextend -l +16642 /dev/mapper/DTVG-root
Size of logical volume DTVG/root changed from 12.50 GiB (3200 extents) to 77.51 GiB (19842 extents).
Logical volume DTVG/root successfully resized.
[root@DS-VM-LinuxEA ~]# xfs_growfs /dev/mapper/DTVG-root
meta-data=/dev/mapper/DTVG-root isize=256 agcount=4, agsize=819200 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0 spinodes=0
data = bsize=4096 blocks=3276800, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 3276800 to 20318208
至此为止扩容完毕
[root@DS-VM-LinuxEA ~]# df -TH
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs 4.2G 0 4.2G 0% /dev
tmpfs tmpfs 4.2G 168k 4.2G 1% /dev/shm
tmpfs tmpfs 4.2G 8.9M 4.2G 1% /run
tmpfs tmpfs 4.2G 0 4.2G 0% /sys/fs/cgroup
/dev/mapper/DTVG-root xfs 84G 3.9G 80G 5% /
/dev/xvda1 xfs 521M 225M 297M 44% /boot
none aufs 84G 3.9G 80G 5% /var/lib/docker/aufs/mnt/d40c515614c6655cd9b07f3f21ce84dbe74465ec546da77a6c80ab9932eb2ae1
shm tmpfs 68M 0 68M 0% /var/lib/docker/containers/7778ffa2e362df5b1bd97869d363c82ed090085cf62efe4500c1def61b5cd309/shm
tmpfs tmpfs 838M 0 838M 0% /run/user/0
[root@DS-VM-LinuxEA ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7778ffa2e362 mysql_mariadb "/initialization.sh" 44 minutes ago Up 5 minutes mariadb
[root@DS-VM-LinuxEA ~]#