Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 63916031 31752192 8e Linux LVM
/dev/sda3 70311936 209715199 69701632 f W95 Ext'd (LBA)
/dev/sda4 64530432 68724735 2097152 8e Linux LVM
/dev/sda5 70313984 133228543 31457280 83 Linux
接下来使用pvcreate /dev/sda5新增pv
使用vgextend rhel /dev/sda5扩展vg
vgextend rhel /dev/sda5
使用lvextend扩展根分区大小,从/dev/sda5中划分空间
lvextend -L +10G /dev/rhel/root /dev/sda5
使用系统自带的xfs_info查看扇区信息,可以看到每个块为4KB,将10G换算成块为2621440,加上原有的就是5181440
xfs_growfs -D 5242880 /dev/mapper/rhel-root
再使用命令df -h查看挂载情况
[root@server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 20G 631M 20G 4% /
devtmpfs 912M 0 912M 0% /dev
tmpfs 921M 164K 921M 1% /dev/shm
tmpfs 921M 9.0M 912M 1% /run
tmpfs 921M 0 921M 0% /sys/fs/cgroup
/dev/mapper/rhel-usr 5.0G 4.2G 834M 84% /usr
/dev/mapper/rhel-home 4.9G 115M 4.8G 3% /home
/dev/mapper/rhel-var 9.8G 515M 9.3G 6% /var
/dev/sda1 197M 89M 109M 45% /boot
根目录已经扩展到20G,后续如果新增可以从扩展分区中新增分区,再按此操作方法增回