how to extend volume group size over the remaining space
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
how to extend volume group size over the remaining space
Hi to all,
after goggling around and looking for in the linux Questions unsuccesfully, I'm here to ask you the way to extend the size of a LVM2 volume group over the remaining free space available on a physical volume.
My linux box is a Ubuntu Karmic 9.10 64bit, the 60GB hard disk has 2 win partition for about 19GB, a 1.5GB ext3 boot partition and finally a 36GB LVM partition (/dev/sda4) on which I created a volume group (volgrp) smaller 10GB than the 36GB physical volume (/dev/sda4).
What I want now is to extend the size of volume group up to the end of physical volume.
I tried to use the "vgextend volgrp /dev/sda4" but system answers me
with following output:
me@pc:~> sudo vgextend volgrp /dev/sda4
Physical volume '/dev/sda4' is already in volume group 'volgrp'
Unable to add physical volume '/dev/sda4' to volume group 'volgrp'.
Here the output of fdisk command:
me@pc:~> sudo fdisk -l
Disk /dev/sda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x5ea4f703
Device Boot Start End Blocks Id System
/dev/sda1 1 637 5116671 1b Hidden W95 FAT32
/dev/sda2 * 638 2465 14683410 c W95 FAT32 (LBA)
/dev/sda3 2466 2596 1052257+ 83 Linux
/dev/sda4 2597 7296 37752750 8e Linux LVM
I try to respond to your question posting you the output of these lvm commands:
ubuntu@ubuntu:~$ sudo pvdisplay
--- Physical volume ---
PV Name /dev/sda4
VG Name volgrp
PV Size 36.00 GB / not usable 3.73 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 9216
Free PE 2560
Allocated PE 6656
PV UUID CWp5JY-X0VN-20WD-hTL9-u1mG-smT5-SAHTxX
So I'm quite sure that when I created the physical volume with pvcreate command (pvcreate /dev/sda4) I used for it the whole size of sda4 partition.
I also post you the output of vgdisplay:
ubuntu@ubuntu:~$ sudo vgdisplay
--- Volume group ---
VG Name volgrp
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 11
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 7
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 36.00 GB
PE Size 4.00 MB
Total PE 9216
Alloc PE / Size 6656 / 26.00 GB
Free PE / Size 2560 / 10.00 GB
VG UUID YS9zRl-I3Zx-yLdL-0VXI-h5pu-XlEl-YWWtkH
As you can see, the size of allocated PEs is 26.00 GB, instead the size of free PE is 10.00 GB.
What I want is to recover the 10GB free PE and to assign them finally to the volume group "volgrp".
ubuntu@ubuntu:~$ sudo vgdisplay
--- Volume group ---
VG Name volgrp
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 12
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 7
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 36.00 GB
PE Size 4.00 MB
Total PE 9216
Alloc PE / Size 7168 / 28.00 GB
Free PE / Size 2048 / 8.00 GB
VG UUID YS9zRl-I3Zx-yLdL-0VXI-h5pu-XlEl-YWWtkH
As you can see, now the free PE space is 8GB, before was 10GB.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.