实例1 剩余空间挂到/data
[2020-12-03_15:48:34] df -Th
[2020-12-03_15:48:40] lsblk -f
[2020-12-03_15:48:40] lsblk /dev/sda
[2020-12-03_15:48:50] vgextend vg01 /dev/vdb
[2020-12-03_15:48:53] lvscan
[2020-12-03_15:48:54] vgscan
[2020-12-03_15:48:56] pvscan
[2020-12-03_15:49:17] lvcreate -L 1T -n data vg01
[2020-12-03_15:49:24] lvscan
[2020-12-03_15:49:32] mkfs.xfs /dev/vg01/data
[2020-12-03_15:49:47] mkdir /data
[2020-12-03_15:49:58] ll /dev/mapper/vg01-data
[2020-12-03_15:49:59] blkid #查询UUID
[2020-12-03_15:50:05] vim /etc/fstab
[2020-12-03_15:50:33] mount -a
[2020-12-03_15:50:35] df -Th
实例2 LVM 扩容 /dev/centos/root
[root@node1 ~]# pvcreate /dev/sda3
[root@node1 ~]# vgextend centos /dev/sda3
[root@node1 ~]# lvextend -L +390G /dev/centos-root
Size of logical volume centos/root changed from <44.00 GiB (11263 extents) to <434.00 GiB (111103 extents).
Logical volume centos/root successfully resized.
[root@node1 ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=2883328 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=11533312, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=5631, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 11533312 to 113769472
[root@node1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 434G 43G 392G 10% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 866M 7.0G 11% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
tmpfs 1.6G 12K 1.6G 1% /run/user/42