lvm使用mbr支持空间50G ,注意写入为增加容量的大小,并非增加完硬盘的大小,mbr支持需要扩容的虚拟机,并通过管理虚拟机界面添加磁盘空间,支持调整50G。硬盘虽然增加了50G ,但是由于没有分区,所以并没有具体显示。
LVM是逻辑卷管理的简写,它是Linux环境下对磁盘分区进行管理的一种机制,它由Heinz Mauelshagen在Linux 2.4内核上实现,Linux用户安装Linux *** 作系统时遇到的一个常见的难以决定的问题就是如何正确地评估各分区大小,以分配合适的硬盘空间。
LVM逻辑卷
用户通过lvm提供接口,依靠内核创建一系列LVM逻辑卷,所有对lvm逻辑卷的读写 *** 作最终都会由LVM在通用块设备层下方截获下来,进行更进一步的处理。
这里的进一步处理主要指的是完成写请求的映射,是将请求的数据根据实际情况进行一些拆分和重定位 *** 作,从而可以将请求和数据分发到实际的物理设备中去。
以上内容参考 百度百科-LVM
使用LVM增加lunux分区的大小的前提是你的分区是LVM格式的。你的说明,你的/分区并不是挂的LVM分区。所以在你这种情况下,你所提问题的答案是:要想不改变数据而更改/分区的大小是不可能的。以后你要想在新装的系统中实现这个功能,一定要记得不要直接将物理分区挂到/分区上(如现在的/dev/sda6),而是那立一个逻辑分区,将逻辑分区挂在/分区上,这样以后想扩展大小就方便了。而至于LVM逻辑分区的创建,我觉得不属于你这个问题的范围内,需要的话你可以补充说明,但自然要加点分咯,嘿嘿...
总结就是pvcreate创建pv,然后vgextend增加lvm大小,再lvextend增加lv_root大小,最后resize2fs就成功了[root@localhost 桌面]# pvcreate /dev/sda3Physical volume "/dev/sda3" successfully created
[root@localhost 桌面]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup
PV Size 7.80 GB / not usable 1.17 MB
Allocatable yes (but full)
PE Size (KByte) 4096
Total PE 1997
Free PE 0
Allocated PE 1997
PV UUID HtJXq0-Gloi-c6ou-VR3X-5SFz-GyD8-EMdMMZ
"/dev/sda3" is a new physical volume of "1019.75 MB"
--- NEW Physical volume ---
PV Name /dev/sda3
VG Name
PV Size 1019.75 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID jrB6nN-u4aH-2NGy-E7X6-KoOq-aKvn-xhtov0
[root@localhost 桌面]# vgextend VolGroup /dev/sda3
Volume group "VolGroup" successfully extended
[root@localhost 桌面]# vgdisplay
--- Volume group ---
VG Name VolGroup
System ID
Formatlvm2
Metadata Areas2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV0
Cur LV2
Open LV 2
Max PV0
Cur PV2
Act PV2
VG Size 8.79 GB
PE Size 4.00 MB
Total PE 2251
Alloc PE / Size 1997 / 7.80 GB
Free PE / Size 254 / 1016.00 MB
VG UUID QXmNgn-tD5Q-Oz2D-g6pf-W9uf-cSIn-3vWImm
[root@localhost 桌面]# lvscan
ACTIVE'/dev/VolGroup/lv_root' [5.83 GB] inherit
ACTIVE'/dev/VolGroup/lv_swap' [1.97 GB] inherit
[root@localhost 桌面]# lvcreate -L 1G -n lv_new VolGroup
Insufficient free extents (254) in volume group VolGroup: 256 required
[root@localhost 桌面]# lvextend -L +1G /VolGroup/lv_root
"/VolGroup/lv_root": Invalid path for Logical Volume
Please provide a volume group name
Run `lvextend --help' for more information.
[root@localhost 桌面]# lvextend -L +1G /dev/VolGroup/lv_root
Extending logical volume lv_root to 6.83 GB
Insufficient free space: 256 extents needed, but only 254 available
[root@localhost 桌面]# lvextend -L +1018m /dev/VolGroup/lv_root
Rounding up size to full physical extent 1020.00 MB
Extending logical volume lv_root to 6.83 GB
Insufficient free space: 255 extents needed, but only 254 available
[root@localhost 桌面]# lvextend -L +1017m /dev/VolGroup/lv_root
Rounding up size to full physical extent 1020.00 MB
Extending logical volume lv_root to 6.83 GB
Insufficient free space: 255 extents needed, but only 254 available
[root@localhost 桌面]# lvextend -L +1016m /dev/VolGroup/lv_root
Extending logical volume lv_root to 6.82 GB
Logical volume lv_root successfully resized
[root@localhost 桌面]# lvscan
ACTIVE'/dev/VolGroup/lv_root' [6.82 GB] inherit
ACTIVE'/dev/VolGroup/lv_swap' [1.97 GB] inherit
[root@localhost 桌面]# pvresize -v /dev/sda2
Using physical volume(s) on command line
Archiving volume group "VolGroup" metadata (seqno 6).
No change to size of physical volume /dev/sda2.
Resizing volume "/dev/sda2" to 16361813 sectors.
Updating physical volume "/dev/sda2"
Creating volume group backup "/etc/lvm/backup/VolGroup" (seqno 7).
Physical volume "/dev/sda2" changed
1 physical volume(s) resized / 0 physical volume(s) not resized[root@localhost /]# resize2fs /dev/VolGroup/lv_root
resize2fs 1.41.9 (22-Aug-2009)
Filesystem at /dev/VolGroup/lv_root is mounted on /on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/VolGroup/lv_root to 1788928 (4k) blocks.
The filesystem on /dev/VolGroup/lv_root is now 1788928 blocks long.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)