如下图。
增加完后会有提示 “磁盘已成功扩展。您必须从客户机操作系统内部对磁盘重新进行分区和扩展文件系统。是继续完成以下步骤才算成功。
# df -h
# fdisk /dev/sda
照着红色部分输入,按回车。
The number of cylinders for this disk isset to 7832.There is nothing wrong with that, but thisis larger than 1024,
and could in certain setups cause problemswith:
1) software that runs at boot time (e.g.,old versions of LILO)
2) booting and partitioning software fromother OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n 说明:新增分区
Command action
e extended
p primarypartition (1-4)
p
Partition number (1-4): 3 说明:新增分区号(1,2默认已经用了)
First cylinder (2611-7832, default 2611): 默认回车(最小)
Using default value 2611
Last cylinder or +size or +sizeM or +sizeK(2611-7832, default 7832):默认回车(最大)
Using default value 7832
Command (m for help): t 说明:修改分区类型
Partition number (1-4): 3 说明:修改分区类型对应的分区号
Hex code (type L to list codes): 8e 说明:8e是lvm磁盘类型
Changed system type of partition 3 to 8e(Linux LVM)
Command (m for help): p 说明:打印分区表
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
/dev/sda3 2611 7832 41945715 8e Linux LVM
Command (m for help): w 说明:保存退出
The partition table has been altered!
# reboot
# fdisk -l
# df -T /dev/sda1 说明:查看当前的主分区类型
# mkfs.ext4 /dev/sda3 说明:ext4为你查看到的文件系统类型(ext2、ext3、ext4等)
# pvcreate /dev/sda3
查看pv状态
# pvdisplay
查看vg状态
# vgdisplay
# vgextend vg_centos /dev/sda3 说明 vg_centos是我的服务器vg名称,请通过查看vg状态得到名称VG name
# lvdisplay
# lvextend -l +2559 /dev/VolGroup00/LogVol00
说明:2559为上面pvdisplay查看到的free的PE数量
如果刚才看到是0,要用命令pvdisplay再看一下
# resize2fs/dev/mapper/VolGroup00-LogVol00