一、增加虚拟机空间配置
1.删除虚拟机系统快照,有快照的虚拟机是不能调整磁盘大小的。
2.在exsi5.1主机下,选中虚拟机,右键编辑设置,打开虚拟机属性设置,调整磁盘大小。
3.重新启动虚拟机,进入查看新的硬盘情况:fdisk -l
二、调整虚拟机磁盘LVM
1.查看现有的硬盘分区(现在空间没有变大)
#df-h
2.对新增的硬盘空间做新增分区(硬盘数没有增加,增加的是空间)
#fdisk /dev/sda
WARNING:DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') andchange display units to
sectors (command 'u').
Command (m for help): n说明:新增分区
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3说明:新增分区号(1,2默认已经使用)
First cylinder(26109-65270, default 26109):
Using default value26109
Last cylinder,+cylinders or +size{K,M,G} (26109-65270, default 65270):
Using default value65270
Command (m for help): t说明:修改分区类型
Partition number (1-4): 3说明:指定分区类型对应的分区号
Hex code (type L to list codes): 8e说明:8e是lvm磁盘类型
Changed system typeof partition 3 to 8e (Linux LVM)
Command (m for help): p说明:打印分区表
Disk /dev/sda: 536.9GB, 536870912000 bytes
255 heads, 63sectors/track, 65270 cylinders
Units = cylinders of16065 * 512 = 8225280 bytes
Sector size(logical/physical): 512 bytes / 512 bytes
I/O size(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:0x000432c6
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does notend on cylinder boundary.
/dev/sda2 64 26109 209202176 8e Linux LVM
/dev/sda3 26109 65270 314566075 8e Linux LVM
Command (m for help): w说明:退出
The partition tablehas been altered!
Calling ioctl() tore-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel stilluses the old table. The new table will be used at
the next reboot orafter you run partprobe(8) or kpartx(8)
Syncing disks.
3.重启系统
#reboot
4.查看硬盘情况(核对刚才所做的分区操作是否保存成功)
#fdisk -l /dev/sda
5.查看当前分区的类型
#df -T /dev/sda1 说明:查看当前的主分区类型
6.创建文件系统在新的磁盘上
#mkfs.ext4/dev/sda3说明:ext4为你查看到的文件系统类型(ext2、ext3、ext4等)
7.创建PV(pv组成vg,vg组成lv)
#pvcreate/dev/sda3
#pvscan
新增加PV尚未加入VG组
8.将新增加的PV加入VG组
#vgextend VolGroup /dev/sda3
9.将VG组中的空闲空间划出到/home分区所在的LV
#lvextend -L +250G /dev/mapper/VolGroup-lv_home
10.使用resizefs2命令重新加载逻辑卷的大小才能生效
#resize2fs/dev/mapper/VolGroup-lv_home
这个过程需要花费一些时间。