标签:
前提条件:
1.在新建虚拟机的时候创建磁盘如下图,之后这个磁盘就可以在虚拟机关机状态下动态扩展大小,否则只能通过添加另外一块硬盘的方式来扩容。
2.centos6.4-minimal-64的默认分区方案
即:硬盘大小16G,一个boot分区,其余为lvm分区,一个vg,两个lv(lv_root和lv_swap)
[root@110-cal ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 14G 2.9G 11G 22% / tmpfs 499M 0 499M 0% /dev/shm /dev/sda1 485M 33M 427M 8% /boot [root@110-cal ~]# fdisk -l Disk /dev/sda: 17.2 GB, 17179869184 bytes 255 heads, 63 sectors/track, 2088 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: 0x00028ecc 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 2089 16264192 8e Linux LVM Disk /dev/mapper/VolGroup-lv_root: 14.9 GB, 14935916544 bytes 255 heads, 63 sectors/track, 1815 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: 1715 MB, 1715470336 bytes 255 heads, 63 sectors/track, 208 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 [root@110-cal ~]#
过程:
1.先关闭虚拟机。
2.打开配置项,调整硬盘大小。
3.开机之后
fdisk -l 看磁盘大小是否正常 fdisk /dev/sda p,n,3,t,8e,p,w reboot pvcreate /dev/sda3 pvdisplay vgdisplay vgextend VolGroup /dev/sda3 lvdisplay lvextend -L +4GB -n /dev/VolGroup/lv_root resize2fs /dev/VolGroup/lv_root reboot 这样就扩容完成了
标签:
原文地址:http://www.cnblogs.com/createyuan/p/4817127.html