LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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

Reply
 
Search this Thread
Old 03-28-2010, 11:38 AM   #1
scrat75
LQ Newbie
 
Registered: Aug 2008
Location: Italy
Distribution: Ubuntu 9.04
Posts: 13

Rep: Reputation: 0
Unhappy 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

Should I use the pvmove command?

Thaks in advance for your help.
 
Old 03-29-2010, 12:56 AM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,301

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Are you saying that you used a pvcreate on sda4 that is less than the available size? If so, you could just use pvresize to expand it http://linux.die.net/man/8/pvresize. See also http://linux.die.net/man/8/vgchange.

Exactly what cmds did you use to create this?

OTOH, it may well be simpler to backup and re-create the pv/vg/lv. You should do a backup anyway before even trying to amend this.
 
Old 03-29-2010, 03:31 PM   #3
scrat75
LQ Newbie
 
Registered: Aug 2008
Location: Italy
Distribution: Ubuntu 9.04
Posts: 13

Original Poster
Rep: Reputation: 0
Hi Chrism01,

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".

Should I perhaps use the lvextend command?

Thanks in advance for your suggestions,

scrat75
 
Old 03-29-2010, 03:51 PM   #4
scrat75
LQ Newbie
 
Registered: Aug 2008
Location: Italy
Distribution: Ubuntu 9.04
Posts: 13

Original Poster
Rep: Reputation: 0
Hi Chrism01,

with the following command I increased the logical volume "usr" size of 2GB.

ubuntu@ubuntu:~$ sudo lvextend -L +2G /dev/volgrp/usr /dev/sda4
Extending logical volume usr to 8.00 GB
Logical volume usr successfully resized

I ran vgscan command and then vgdiplay:

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.

Now I restart to see if all things are good..

Scrat75
 
  


Reply

Tags
lvm2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't extend volume group flv7a Linux - General 13 09-14-2010 03:04 PM
How do I shrink a volume group once I have created free space in it? Mountain Linux - General 5 10-28-2009 08:54 PM
how can increase my physical volume group space in linux ilu_nishant Linux - Newbie 3 09-12-2009 01:41 PM
Can I increase the size of a physical volume in an lvm group? If so, how? MikeB23930 Fedora 2 07-21-2009 05:38 PM
Used space is more than volume size? krnlg Linux - Desktop 2 12-04-2007 04:36 AM


All times are GMT -5. The time now is 07:36 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration