先查看df -h 的分区大小
fdisk /dev/sda (选择新扩的硬盘)
Command (m for help): p (查看硬盘的分区情况)
Disk /dev/sda: 171.8 GB, 171798691840 bytes
255 heads, 63 sectors/track, 20886 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d8f65
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 10444 83680256 8e Linux LVM
Command (m for help): n (新建一个分区)
e extended
p primary partition (1-4)
P (选择主分区)
Partition number (1-4): 3 (选择分区号)
First cylinder (10444-20886, default 10444):
Last cylinder or +size or +sizeM or +sizeK (10444-20886, default 20886):
Command (m for help): p (查看分区情况)
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 10444 83680256 8e Linux LVM
/dev/sda3 10444 20886 83880715 83 Linux (新建的分区)
Command (m for help):w (保存退出)
[root@B2E-IMDB ~]# reboot (重启生效)
#pvdisplay 查看物理卷名称 rootvg 查看新增的硬盘是70/80G
[root@B2E-IMDB ~]# pvcreate /dev/sda3 创建物理卷
将物理卷加进卷组 rootvg
#vgextend rootvg /dev/sda3
[root@B2E-IMDB ~]# lvextend -L +79G /dev/rootvg/lv_opt (root)
加入 80G 可以不写或者lvextend -L +100%FREE
[root@B2E-IMDB ~]# resize2fs /dev/rootvg/lv_opt 生效
[root@B2E-IMDB ~]# df -h