Hi,
I was wondering if there was a way to extend (ie: grow) a PV that is part of a Volume Group? I currently have a partition on my HD that is being used as a PV for my Volume Group, but would like to make it larger. I have the space on my drive to extend my partition, but using standard tools (ex: gparted, Partition Magic, etc) would likely end up corrupting the data on in the Logical Volumes that are housed within the VG.
I realize that I could just create a new partition on my HD and just add it to my Volume Group and extend my Volume Group, however, given that it would be two contiguous partitions on the HD, I was just wondering if there was a way of resizing the original partition within the VG without causing any problems.
I tried looking at tools like pvresize but I can't seem to understand the right arguments to use it as whatever I try never seems to resize the original partition itself. I also looked at system-config-lvm GUI tool, but that doesn't seem to allow me to make the PV any larger.
Does anyone have any suggestions?
Thanks!
Eric
On 19/02/10 10:11, Eric B. wrote:
Hi,
I was wondering if there was a way to extend (ie: grow) a PV that is part of a Volume Group? I currently have a partition on my HD that is being used as a PV for my Volume Group, but would like to make it larger. I have the space on my drive to extend my partition, but using standard tools (ex: gparted, Partition Magic, etc) would likely end up corrupting the data on in the Logical Volumes that are housed within the VG.
I realize that I could just create a new partition on my HD and just add it to my Volume Group and extend my Volume Group, however, given that it would be two contiguous partitions on the HD, I was just wondering if there was a way of resizing the original partition within the VG without causing any problems.
I tried looking at tools like pvresize but I can't seem to understand the right arguments to use it as whatever I try never seems to resize the original partition itself. I also looked at system-config-lvm GUI tool, but that doesn't seem to allow me to make the PV any larger.
Does anyone have any suggestions?
Thanks!
Eric
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Hi I remember having done this once recently on a test system. And I strongly suggest you don't attempt unless you have a good backup. You use the standard tools to resize the partition and then pvresize to see the new size of the PV. Once you can see that the new size of the PV is recognised by the VG you can allocate the space.
Clint Dilks wrote:
On 19/02/10 10:11, Eric B. wrote:
Hi,
I was wondering if there was a way to extend (ie: grow) a PV that is part of a Volume Group? I currently have a partition on my HD that is being used as a PV for my Volume Group, but would like to make it larger. I have the space on my drive to extend my partition, but using standard tools (ex: gparted, Partition Magic, etc) would likely end up corrupting the data on in the Logical Volumes that are housed within the VG.
I realize that I could just create a new partition on my HD and just add it to my Volume Group and extend my Volume Group, however, given that it would be two contiguous partitions on the HD, I was just wondering if there was a way of resizing the original partition within the VG without causing any problems.
I tried looking at tools like pvresize but I can't seem to understand the right arguments to use it as whatever I try never seems to resize the original partition itself. I also looked at system-config-lvm GUI tool, but that doesn't seem to allow me to make the PV any larger.
Does anyone have any suggestions?
Thanks!
Eric
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Hi I remember having done this once recently on a test system. And I strongly suggest you don't attempt unless you have a good backup. You use the standard tools to resize the partition and then pvresize to see the new size of the PV. Once you can see that the new size of the PV is recognised by the VG you can allocate the space. _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Hi,
This was discusssed back in May by Gavin Carr http://lists.centos.org/pipermail/centos/2009-May.txt
Phil.
Hi,
I was wondering if there was a way to extend (ie: grow) a PV that is part of a Volume Group? I currently have a partition on my HD that is being used as a PV for my Volume Group, but would like to make it larger. I have the space on my drive to extend my partition, but using standard tools (ex: gparted, Partition Magic, etc) would likely end up corrupting the data on in the Logical Volumes that are housed within the VG.
[ ... ]
I tried looking at tools like pvresize but I can't seem to understand the right arguments to use it as whatever I try never seems to resize the original partition itself. I also looked at system-config-lvm GUI tool, but that doesn't seem to allow me to make the PV any larger.
Does anyone have any suggestions?
Thanks!
Eric
Given the partition which is a physical volume can be enlarged because there is free space directly after the end of the current partition, you then can do following very easily:
1) fdisk /dev/<device> 1a) delete the partition to enlarge 1b) re-create the partition from the same starting point to the new size 1c) save the changes
2) partprobe /dev/<device> to let the kernel know about the change
3) pvresize /dev/<deviceNUM> increases the PV to maximum partition size (just as the manpage says)
4) pvdisplay /dev/<deviceNUM> should show you now free physical extends (vgdisplay as well)
5) lvresize -L +100%FREE /dev/mapper/<LVM-volume> expands the volume to use all free extends or split up the additional size to several volumes
6) resize2fs /dev/mapper/<LVM-volume> to let the filesystem know about the additional space
Regards
Alexander
On Fri, Feb 19, 2010 at 12:23:31PM +0100, Alexander Dalloz wrote:
Given the partition which is a physical volume can be enlarged because there is free space directly after the end of the current partition, you then can do following very easily:
- fdisk /dev/<device>
1a) delete the partition to enlarge 1b) re-create the partition from the same starting point to the new size 1c) save the changes
- partprobe /dev/<device> to let the kernel know about the change
Will this work if any partitions on <device> are mounted? When I have run fdisk to modify a partition table, the kernel complains that it can't reread the partition table if there are mounted filesystems on the target disk. If the root filesystem is on the target disk, a reboot might be required. (In the past, fdisk has alerted the kernel if there's been a partition table change, so partprobe might not be needed.)
And of course, have backups when messing with the partition table. :)
--keith
----- Original Message ----
From: Eric B. ebenze@hotmail.com To: centos@centos.org Cc: linux-lvm@redhat.com Sent: Thu, February 18, 2010 6:11:26 PM Subject: [CentOS] Resizing a PV that belongs within a Volume Group?
Hi,
I was wondering if there was a way to extend (ie: grow) a PV that is part of a Volume Group? I currently have a partition on my HD that is being used as a PV for my Volume Group, but would like to make it larger. I have the space on my drive to extend my partition, but using standard tools (ex: gparted, Partition Magic, etc) would likely end up corrupting the data on in the Logical Volumes that are housed within the VG.
I realize that I could just create a new partition on my HD and just add it to my Volume Group and extend my Volume Group, however, given that it would be two contiguous partitions on the HD, I was just wondering if there was a way of resizing the original partition within the VG without causing any problems.
I tried looking at tools like pvresize but I can't seem to understand the right arguments to use it as whatever I try never seems to resize the original partition itself. I also looked at system-config-lvm GUI tool, but that doesn't seem to allow me to make the PV any larger.
Does anyone have any suggestions?
First extend the physical media (resize the partition, LUN, whatever), then just pvresize the new partition
Use with care, test it a few times in a test box or VM, then try it in production, if you screw up you'll lose your data.
Or just do it simple... take the extra free space on the disk, create a new partition there and add that as a new PV to the VG.