1、对新增的磁盘进行分区(注:可省略)
PS:使用fdisk或gdisk(大于2T时使用)对新增磁盘进行分区。
[root@kvm-clinet ~]# fdisk/dev/sdb
Welcome to fdisk (util‐linux 2.23.2).4
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
All primary partitions are in use
Adding logical partition 1
First sector (26654720‐41943039, default 26654720): <‐‐‐ 直接回车,使用默认起始柱面
Using default value 26654720
Last sector, +sectors or +size{K,M,G} (26654720‐41943039, default 41943039): <‐‐‐ 直接回车,使用默认结束柱面,用完所有空间
Using default value 41943039
Partition 6 of type Linux and of size 7.3 GiB is set
Command (m for help): t <‐‐‐‐ 修改分区类型标记
Partition number (1‐6, default 1): <‐‐‐ 直接回车,修改刚刚划分的分区
Hex code (type L to list all codes): 8e <‐‐‐‐8e 代表把类型修改为 Linux LVM
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w<‐‐‐‐ 保存分区设定
[root@kvm-clinet ~]# partprobe
[root@kvm-clinet ~]# ls ‐l /dev/sdb1
brw‐rw‐‐‐‐. 1 root disk 8, 6 Jan 19 16:05 /dev/sdb1
2、确认根目录的卷名和卷组
[root@kvm-clinet ~]# df -hT
[root@kvm-clinet ~]# lvdisplay <‐‐‐‐查看现逻辑卷
3、扩充卷组和逻辑卷
[root@kvm-clinet ~]# pvcreate /dev/sdb1 <------将物理磁盘设备或物理磁盘分区初始化为物理卷
File descriptor 3 (pipe:[54618]) leaked on pvcreate invocation. Parent PID 1704: ‐bash
Physical volume "/dev/sdb1" successfully created
[root@kvm-clinet ~]# vgextend centos /dev/sdb1 <------将新的pv添加到指定郑组centos中
Volume group “centos” sucessfully extended
[root@kvm-clinet ~]# vgdisplay <----查看扩充后VG大小
[root@kvm-clinet ~]# lvextend -L +10G /dev/centos/root <-----拉伸逻辑卷
[root@kvm-clinet ~]# lvdisplay <----查看扩充后LV大小
[root@kvm-clinet ~]# resize2fs /dev/centos/root <---刷新文件系统的容量信息,注意:如果文件系统是 xfs ,那么应该执行 xfs_growfs /dev/centos/root
[root@kvm-clinet ~]# df ‐hT <---确认是否成功