您的位置:首页 > 运维架构 > Linux

VM增加centos6.5磁盘容量

2015-07-29 17:40 711 查看
参考博文:http://www.cnblogs.com/sixiweb/p/3360008.html
编辑设置,修改硬盘大小
[root@localhost ~]# fdisk -l  #查看磁盘分区情况

Disk /dev/sda: 59.1 GB, 59055800320 bytes  #现有的磁盘容量
255 heads, 63 sectors/track, 7179 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: 0x000efc13

Device Boot      Start         End      Blocks   Id  System  #现有磁盘的分配情况
/dev/sda1   *           1          64      512000   83  Linux    #主分区
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1045     7875584   8e  Linux LVM  #扩展分区
/dev/sda3            1045        6527    44039519+  8e  Linux LVM  #扩展分区

Disk /dev/mapper/VolGroup-lv_root: 51.2 GB, 51229229056 bytes
255 heads, 63 sectors/track, 6228 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: 0x00000000

Disk /dev/mapper/VolGroup-lv_swap: 855 MB, 855638016 bytes
255 heads, 63 sectors/track, 104 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: 0x00000000
关闭VMWARE的linux系统,设置原有硬盘容量后开机。
#添加新分区,在原容量基础上加载新容量
[root@localhost ~]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help):
输入n,回车。新增一个分区

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
输入P,回车 选择主分区
输入4,回车 选择分区4,因为上面查询到sda1,sda2,sda3都已经被使用
输入8e,回车 更改为lvm

输入w,回车 保存设置,然后重启电脑
开机后格式化刚才的新分区
[root@localhost ~]#
#实现扩容

[root@localhost ~]# lvm    #进入lvm模式
lvm> pvcreate /dev/sda3         这是初始化刚才的分区,必须的
lvm> vgextend VolGroup /dev/sda3   将初始化过的分区加入到虚拟卷组vg_dc01
lvm>lvextend -L +29.9G /dev/vg_dc01/lv_root  扩展已有卷的容量(29.9G这个数字在后面解释)
lvm>pvdisplay              查看卷容量,这时你会看到一个很大的卷了
lvm>quit                 退出

[root@localhost ~]# resize2fs /dev/mapper/VolGroup-lv_root
再输入df -h 查看一下硬盘容量
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: