除非重建VG
创建VG时可指定PE大小,比如PE为32M:
vgcreate -s 32M vgname /dev/sda2
请查阅man vgcreate 中的-s选项。我发现lvm2最大单个PE size可以设置到1T。2T就不可以了。你可以使用vgcreate -s 1T。设置看看。这时我发现的。你可以测试一下。我上RHCE的时候老师说最小是4M最大32M可是我看了man发现完全推翻了。这个说法。我现在也迷茫了。LVM1的限制为8K~16G
LVM2的限制为1K~1T
总结就是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条)