[root@szxdb software]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 60G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 59G 0 part
├─centos-root 253:0 0 38.3G 0 lvm /
├─centos-swap 253:1 0 2G 0 lvm [SWAP]
└─centos-home 253:2 0 18.7G 0 lvm /home
sdb 8:16 0 300G 0 disk
sr0 11:0 1 1024M 0 rom
[root@szxdb software]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 xfs 736c31a9-99c2-4a7d-aef4-6e0f2e877ceb /boot
└─sda2 LVM2_member RrMd6r-7hKr-J3pu-L1kC-BpwR-Paj3-ebdCYb
├─centos-root xfs 047fd870-ae52-4b7f-a018-637e69f502d9 /
├─centos-swap swap 74a537ad-6d61-4e4e-879f-667cba216848 [SWAP]
└─centos-home xfs 98f13f9c-274f-4cee-b465-26b3f60bf4ae /home
sdb
sr0
[root@szxdb software]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 12M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 39G 6.3G 32G 17% /
/dev/sda1 1014M 154M 861M 16% /boot
/dev/mapper/centos-home 19G 12G 7.6G 60% /home
tmpfs 1.6G 0 1.6G 0% /run/user/0
[root@szxdb software]# mkfs.xfs /dev/sdb
meta-data=/dev/sdb isize=512 agcount=4, agsize=19660800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=78643200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=38400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@szxdb software]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 xfs 736c31a9-99c2-4a7d-aef4-6e0f2e877ceb /boot
└─sda2 LVM2_member RrMd6r-7hKr-J3pu-L1kC-BpwR-Paj3-ebdCYb
├─centos-root xfs 047fd870-ae52-4b7f-a018-637e69f502d9 /
├─centos-swap swap 74a537ad-6d61-4e4e-879f-667cba216848 [SWAP]
└─centos-home xfs 98f13f9c-274f-4cee-b465-26b3f60bf4ae /home
sdb xfs 07d4dcd6-b4bd-40ae-a1f3-fd8098551063
sr0
[root@szxdb software]# pvcreate /dev/sdb
WARNING: xfs signature detected on /dev/sdb at offset 0. Wipe it? [y/n]: y
Wiping xfs signature on /dev/sdb.
Physical volume "/dev/sdb" successfully created.
[root@szxdb software]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 3 0 wz--n- <59.00g 4.00m
[root@szxdb software]# vgextend centos /dev/sdb
Volume group "centos" successfully extended
[root@szxdb software]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 12M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 39G 6.3G 32G 17% /
/dev/sda1 1014M 154M 861M 16% /boot
/dev/mapper/centos-home 19G 12G 7.6G 60% /home
tmpfs 1.6G 0 1.6G 0% /run/user/0
[root@szxdb software]# lvextend /dev/mapper/centos-home /dev/sdb
Size of logical volume centos/home changed from <18.70 GiB (4786 extents) to 318.69 GiB (81585 extents).
Logical volume centos/home successfully resized.
[root@szxdb software]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 12M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 39G 6.3G 32G 17% /
/dev/sda1 1014M 154M 861M 16% /boot
/dev/mapper/centos-home 19G 12G 7.6G 60% /home
tmpfs 1.6G 0 1.6G 0% /run/user/0
[root@szxdb software]# xfs_growfs /dev/mapper/centos-home
meta-data=/dev/mapper/centos-home isize=512 agcount=4, agsize=1225216 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=4900864, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
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 4900864 to 83543040
[root@szxdb software]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 12M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 39G 6.3G 32G 17% /
/dev/sda1 1014M 154M 861M 16% /boot
/dev/mapper/centos-home 319G 12G 308G 4% /home
tmpfs 1.6G 0 1.6G 0% /run/user/0
标签:扩容,centos,dev,sdb,Linux,lvm,xfs,root,7.8
From: https://www.cnblogs.com/sddll/p/18223394