1 查看磁盘空间是否已经扩展
fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
PS: 查看磁盘空间大小是否是变化的 在使用 fdisk -l之后 查看关于 /dev/sda的大小
2 fdisk /dev/sda 开始进行扩展分区
fdisk /dev/sda
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3): 3
First sector (41943040-62914559, default 41943040):
Using default value 41943040
Last sector, +sectors or +size{K,M,G} (41943040-62914559, default 62914559):
Using default value 62914559
Partition 3 of type Linux and of size 10 GiB is set
Command (m for help): t
Partition number (1-3, default 3): 3
Hex code (type L to list all codes): L
.......
..........
.......
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w
确认是否已经添加了sda3
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
/dev/sda3 41943040 62914559 10485760 8e Linux LVM
pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created.
vgs
VG #PV #LV #SN Attr VSize VFree
rhel 2 2 0 wz--n- 78.99g 50.00g
vgextend rhel /dev/sda3
lvextend /dev/rhel/root /dev/sda3
xfs_growfs /dev/mapper/rhel-root
使用xfs_growfs可以将xfs文件系统进行online方式的扩展,它会将data block进行调整
ps:是将 / 目录的大小扩大此项是为了