说明:系统版本为 Linux version 3.10.0-327.el7.x86_64
step1. 查看现有磁盘信息,可以看出根分区有45G
[root@DEV-CMDB-DB02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_mb--centos7-root 45G .8G 35G % /
devtmpfs .9G .9G % /dev
tmpfs .9G 84K .9G % /dev/shm
tmpfs .9G 8.9M .9G % /run
tmpfs .9G .9G % /sys/fs/cgroup
/dev/sda1 497M 142M 356M % /boot
tmpfs .2G 16K .2G % /run/user/
tmpfs .2G .2G % /run/user/
step2. 查看新增加的磁盘信息
[root@DEV-CMDB-DB02 ~]# fdisk -l Disk /dev/sda: 53.7 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x000e0945 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM Disk /dev/sdb: 107.4 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes Disk /dev/mapper/centos_mb--centos7-root: 47.7 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes Disk /dev/mapper/centos_mb--centos7-swap: MB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
step3. 根据以上信息,对新增加的磁盘进行分区
[root@DEV-CMDB-DB02 ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.). Changes will remain in memory only, until you decide to write them.
Be careful before using the write command. Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x232defba. Command (m for help): p Disk /dev/sdb: 107.4 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x232defba Device Boot Start End Blocks Id System Command (m for help): n
Partition type:
p primary ( primary, extended, free)
e extended
Select (default p): p
Partition number (-, default ):
First sector (-, default ):
Using default value
Last sector, +sectors or +size{K,M,G} (-, default ):
Using default value
Partition of type Linux and of size GiB is set Command (m for help): t
Selected partition
Hex code (type L to list all codes): L Empty NEC DOS Minix / old Lin bf Solaris
FAT12 Hidden NTFS Win Linux swap / So c1 DRDOS/sec (FAT-
XENIX root Plan Linux c4 DRDOS/sec (FAT-
XENIX usr 3c PartitionMagic OS/ hidden C: c6 DRDOS/sec (FAT-
FAT16 <32M Venix Linux extended c7 Syrinx
Extended PPC PReP Boot NTFS volume set da Non-FS data
FAT16 SFS NTFS volume set db CP/M / CTOS / .
HPFS/NTFS/exFAT 4d QNX4.x Linux plaintext de Dell Utility
AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
AIX bootable 4f QNX4.x 3rd part Amoeba e1 DOS access
a OS/ Boot Manag OnTrack DM Amoeba BBT e3 DOS R/O
b W95 FAT32 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
OPUS EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
Hidden FAT12 Golden Bow a8 Darwin UFS f1 SpeedStor
Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
Hidden FAT16 < SpeedStor ab Darwin boot f2 DOS secondary
Hidden FAT16 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
Hidden HPFS/NTF Novell Netware b7 BSDI fs fc VMware VMKCORE
AST SmartSleep Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 Old Minix
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM' Command (m for help): p Disk /dev/sdb: 107.4 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x232defba Device Boot Start End Blocks Id System
/dev/sdb1 8e Linux LVM Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table.
Syncing disks.
step4. 创建物理卷
[root@DEV-CMDB-DB02 ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
step5. 查看物理卷信息
[root@DEV-CMDB-DB02 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name centos_mb-centos7
PV Size 49.51 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE
Free PE
Allocated PE
PV UUID 8WbgjB-T1Lf-kqUD-qPFw-UwJu-B9Lc-GAUTUB "/dev/sdb1" is a new physical volume of "100.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 100.00 GiB
Allocatable NO
PE Size
Total PE
Free PE
Allocated PE
PV UUID HOknRs-TnMy-wtfX-sGqD-5RK9-dk9q-ze13fj
[root@DEV-CMDB-DB02 ~]# vgdisplay
--- Volume group ---
VG Name centos_mb-centos7
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 49.51 GiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / 49.47 GiB
Free PE / Size / 40.00 MiB
VG UUID aN2D2P-Rk1y-wGFz-5l2I-5CcD-7s88-Z8czc7
step6. 将新增加的分区/dev/sdb1加入到根目录分区centos_mb-centos7中
[root@DEV-CMDB-DB02 ~]# vgextend centos_mb-centos7 /dev/sdb1
Volume group "centos_mb-centos7" successfully extended
step7. 重新查看卷组信息
[root@DEV-CMDB-DB02 ~]# vgdisplay
--- Volume group ---
VG Name centos_mb-centos7
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 149.50 GiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / 49.47 GiB
Free PE / Size 25609 / 100.04 GiB
VG UUID aN2D2P-Rk1y-wGFz-5l2I-5CcD-7s88-Z8czc7
step9. 进行卷扩容
[root@DEV-CMDB-DB02 ~]# lvextend -l +%FREE /dev/mapper/centos_mb--centos7-root
Size of logical volume centos_mb-centos7/root changed from 44.47 GiB ( extents) to 144.50 GiB ( extents).
Logical volume root successfully resized.
step10. 调整卷分区大小
[root@DEV-CMDB-DB02 ~]# xfs_growfs /dev/mapper/centos_mb--centos7-root
meta-data=/dev/mapper/centos_mb--centos7-root isize= agcount=, agsize= blks
= sectsz= attr=, projid32bit=
= crc= finobt=
data = bsize= blocks=, imaxpct=
= sunit= swidth= blks
naming =version bsize= ascii-ci= ftype=
log =internal bsize= blocks=, version=
= sectsz= sunit= blks, lazy-count=
realtime =none extsz= blocks=, rtextents=
data blocks changed from to
最后,查看磁盘信息可以看出根目录分区大小已成功扩容
[root@DEV-CMDB-DB02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_mb--centos7-root 145G .8G 135G % /
devtmpfs .9G .9G % /dev
tmpfs .9G 84K .9G % /dev/shm
tmpfs .9G 8.9M .9G % /run
tmpfs .9G .9G % /sys/fs/cgroup
/dev/sda1 497M 142M 356M % /boot
tmpfs .2G 16K .2G % /run/user/
tmpfs .2G .2G % /run/user/