Bernard Fay
2017-Feb-22 13:42 UTC
[CentOS] how to resize a partition of a disk define as a physical volume
How do you resize the partition without loosing data? gparted does not support LVM. On Wed, Feb 22, 2017 at 8:37 AM, SysAdmin <admin at s-s.network> wrote:> Hi, > > you need to resize partition /dev/xvda2, afterwards resize pv. > > Regards, > Holger > > > -----Urspr?ngliche Nachricht----- > > Von: CentOS [mailto:centos-bounces at centos.org] Im Auftrag von Bernard > > Fay > > Gesendet: Mittwoch, 22. Februar 2017 14:18 > > An: CentOS mailing list > > Betreff: Re: [CentOS] how to resize a partition of a disk define as a > > physical volume > > > > I should have added the output of pvs: > > > > [root ~]# pvs > > PV VG Fmt Attr PSize PFree > > /dev/xvda2 cl_vm731611 lvm2 a-- 9.00g 0 > > > > PFree still show 0. It should show 5g. > > > > Also: > > [root ~]# pvdisplay /dev/xvda2 > > --- Physical volume --- > > PV Name /dev/xvda2 > > VG Name cl_vm731611 > > PV Size 9.00 GiB / not usable 2.00 MiB > > Allocatable yes (but full) > > PE Size 4.00 MiB > > Total PE 2303 > > Free PE 0 > > Allocated PE 2303 > > PV UUID RtXa0c-07RP-RJ0V-kSjC-Tuo0-5QQv-sQIKlr > > > > > > With fdisk, we can see the additional space has is there as it shows > > 16GB. > > The original disk had 10GB. > > [root ~]# fdisk -l /dev/xvda > > > > Disk /dev/xvda: 16.1 GB, 16106127360 bytes, 31457280 sectors [snip] > > > > Device Boot Start End Blocks Id System > > /dev/xvda1 * 2048 2099199 1048576 83 Linux > > /dev/xvda2 2099200 20971519 9436160 8e Linux LVM > > > > > > vgs also shows 0 Free PE: > > [root at CTSSVN01 ~]# vgs > > VG #PV #LV #SN Attr VSize VFree > > cl_vm731611 1 2 0 wz--n- 9.00g 0 > > > > > > Thanks, > > > > > > On Wed, Feb 22, 2017 at 8:06 AM, Jon LaBadie <jcu at labadie.us> wrote: > > > > > On Wed, Feb 22, 2017 at 07:44:33AM -0500, Bernard Fay wrote: > > > > Hello, > > > > > > > > I have a CentOS VM with only one disk on a Xenserver. > > > > > > > > The disk has 2 partitions: > > > > > > > > /dev/xvda1 -> /boot > > > > /dev/xvda2 -> a physical volume for LVM > > > > > > > > > > > > I added 5GB to this disk via Xencenter to extend /dev/xvda2. > > > > Usually I just have to do "pvresize /dev/xvda" to have the > > > > additional space added > > > to > > > > the disk. But for some reason it does not work for this disk. > > > > > > > > [root ~]# pvresize /dev/xvda > > > > Failed to find physical volume "/dev/xvda". > > > > 0 physical volume(s) resized / 0 physical volume(s) not resized > > > > > > > > [root ~]# pvresize /dev/xvda2 > > > > Physical volume "/dev/xvda2" changed > > > > 1 physical volume(s) resized / 0 physical volume(s) not resized > > > > > > > > > > > > Does someone have seen this problem before or could have an idea of > > > > the problem? > > > > > > Looks like xvda2 was resized. You should now have an added 5GB worth > > > of unallocated extents in the vg > > > > > > -- > > > Jon H. LaBadie jon at jgcomp.com > > > 11226 South Shore Rd. (703) 787-0688 (H) > > > Reston, VA 20190 (703) 935-6720 (C) > > > _______________________________________________ > > > CentOS mailing list > > > CentOS at centos.org > > > https://lists.centos.org/mailman/listinfo/centos > > > > > _______________________________________________ > > CentOS mailing list > > CentOS at centos.org > > https://lists.centos.org/mailman/listinfo/centos > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >
Gianluca Cecchi
2017-Feb-22 13:52 UTC
[CentOS] how to resize a partition of a disk define as a physical volume
On Wed, Feb 22, 2017 at 2:42 PM, Bernard Fay <bernard.fay at gmail.com> wrote:> How do you resize the partition without loosing data? > > gparted does not support LVM. > >It is preferrable to create PV on the whole disk also to manage these kind of situations. In case I have to manage with partitions, the must is that you can do it only if it is the last partition, and you are ok. Normally I use fidsk and I first delete the last partition and then without exiting the utility I create again it using the same starting point and the new larger end. For this, take care of using option to show sectors and not cylinders ("u" switches between the two options) and print your partition layout ("p" comamnd), so that you can set exactly the same starting point of the new xvda2 partition otherwise you will have destroyed it and LVM layer would not be able to identify it (also the type if now it is 8e for Linux LVM). Eventually you will have to run also the command partprobe /dev/xvda to align os with new partition layout Take care and read well (also on other sources on internet in case). Also backup your partiion layout before making changes with sfdisk -d /dev/xvda > part_table.before and compare with what you have after. HIH, Gianluca
Bernard Fay
2017-Feb-22 14:05 UTC
[CentOS] how to resize a partition of a disk define as a physical volume
I usually use the whole disk a PV but this disk has the /boot partition which cannot be LVM. I decided to simply use the third partition as another PV and extended the VG. Thanks, On Wed, Feb 22, 2017 at 8:52 AM, Gianluca Cecchi <gianluca.cecchi at gmail.com> wrote:> On Wed, Feb 22, 2017 at 2:42 PM, Bernard Fay <bernard.fay at gmail.com> > wrote: > > > How do you resize the partition without loosing data? > > > > gparted does not support LVM. > > > > > It is preferrable to create PV on the whole disk also to manage these kind > of situations. > In case I have to manage with partitions, the must is that you can do it > only if it is the last partition, and you are ok. > Normally I use fidsk and I first delete the last partition and then without > exiting the utility I create again it using the same starting point and the > new larger end. > For this, take care of using option to show sectors and not cylinders ("u" > switches between the two options) and print your partition layout ("p" > comamnd), so that you can set exactly the same starting point of the new > xvda2 partition otherwise you will have destroyed it and LVM layer would > not be able to identify it (also the type if now it is 8e for Linux LVM). > Eventually you will have to run also the command > > partprobe /dev/xvda > > to align os with new partition layout > > Take care and read well (also on other sources on internet in case). Also > backup your partiion layout before making changes with > > sfdisk -d /dev/xvda > part_table.before > > and compare with what you have after. > > HIH, > Gianluca > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >
John Hodrien
2017-Feb-22 14:19 UTC
[CentOS] how to resize a partition of a disk define as a physical volume
On Wed, 22 Feb 2017, Gianluca Cecchi wrote:> On Wed, Feb 22, 2017 at 2:42 PM, Bernard Fay <bernard.fay at gmail.com> wrote: > >> How do you resize the partition without loosing data? >> >> gparted does not support LVM.If you don't trust yourself to do it right, just create a new partition on the disk, pvcreate it, add it to the existing volume group. jh
m.roth at 5-cent.us
2017-Feb-22 16:17 UTC
[CentOS] how to resize a partition of a disk define as a physical volume
Bernard Fay wrote:> How do you resize the partition without loosing data? > > gparted does not support LVM.Dunno 'bout gparted, but parted->t, if you ask for help, it lists types, and linux lvm is one type. A quick search tells me partition type e1. mark> > > > On Wed, Feb 22, 2017 at 8:37 AM, SysAdmin <admin at s-s.network> wrote: > >> Hi, >> >> you need to resize partition /dev/xvda2, afterwards resize pv. >> >> Regards, >> Holger >> >> > -----Urspr?ngliche Nachricht----- >> > Von: CentOS [mailto:centos-bounces at centos.org] Im Auftrag von Bernard >> > Fay >> > Gesendet: Mittwoch, 22. Februar 2017 14:18 >> > An: CentOS mailing list >> > Betreff: Re: [CentOS] how to resize a partition of a disk define as a >> > physical volume >> > >> > I should have added the output of pvs: >> > >> > [root ~]# pvs >> > PV VG Fmt Attr PSize PFree >> > /dev/xvda2 cl_vm731611 lvm2 a-- 9.00g 0 >> > >> > PFree still show 0. It should show 5g. >> > >> > Also: >> > [root ~]# pvdisplay /dev/xvda2 >> > --- Physical volume --- >> > PV Name /dev/xvda2 >> > VG Name cl_vm731611 >> > PV Size 9.00 GiB / not usable 2.00 MiB >> > Allocatable yes (but full) >> > PE Size 4.00 MiB >> > Total PE 2303 >> > Free PE 0 >> > Allocated PE 2303 >> > PV UUID RtXa0c-07RP-RJ0V-kSjC-Tuo0-5QQv-sQIKlr >> > >> > >> > With fdisk, we can see the additional space has is there as it shows >> > 16GB. >> > The original disk had 10GB. >> > [root ~]# fdisk -l /dev/xvda >> > >> > Disk /dev/xvda: 16.1 GB, 16106127360 bytes, 31457280 sectors [snip] >> > >> > Device Boot Start End Blocks Id System >> > /dev/xvda1 * 2048 2099199 1048576 83 Linux >> > /dev/xvda2 2099200 20971519 9436160 8e Linux LVM >> > >> > >> > vgs also shows 0 Free PE: >> > [root at CTSSVN01 ~]# vgs >> > VG #PV #LV #SN Attr VSize VFree >> > cl_vm731611 1 2 0 wz--n- 9.00g 0 >> > >> > >> > Thanks, >> > >> > >> > On Wed, Feb 22, 2017 at 8:06 AM, Jon LaBadie <jcu at labadie.us> wrote: >> > >> > > On Wed, Feb 22, 2017 at 07:44:33AM -0500, Bernard Fay wrote: >> > > > Hello, >> > > > >> > > > I have a CentOS VM with only one disk on a Xenserver. >> > > > >> > > > The disk has 2 partitions: >> > > > >> > > > /dev/xvda1 -> /boot >> > > > /dev/xvda2 -> a physical volume for LVM >> > > > >> > > > >> > > > I added 5GB to this disk via Xencenter to extend /dev/xvda2. >> > > > Usually I just have to do "pvresize /dev/xvda" to have the >> > > > additional space added >> > > to >> > > > the disk. But for some reason it does not work for this disk. >> > > > >> > > > [root ~]# pvresize /dev/xvda >> > > > Failed to find physical volume "/dev/xvda". >> > > > 0 physical volume(s) resized / 0 physical volume(s) not resized >> > > > >> > > > [root ~]# pvresize /dev/xvda2 >> > > > Physical volume "/dev/xvda2" changed >> > > > 1 physical volume(s) resized / 0 physical volume(s) not resized >> > > > >> > > > >> > > > Does someone have seen this problem before or could have an idea >> of >> > > > the problem? >> > > >> > > Looks like xvda2 was resized. You should now have an added 5GB >> worth >> > > of unallocated extents in the vg >> > > >> > > -- >> > > Jon H. LaBadie jon at jgcomp.com >> > > 11226 South Shore Rd. (703) 787-0688 (H) >> > > Reston, VA 20190 (703) 935-6720 (C) >> > > _______________________________________________ >> > > CentOS mailing list >> > > CentOS at centos.org >> > > https://lists.centos.org/mailman/listinfo/centos >> > > >> > _______________________________________________ >> > CentOS mailing list >> > CentOS at centos.org >> > https://lists.centos.org/mailman/listinfo/centos >> >> _______________________________________________ >> CentOS mailing list >> CentOS at centos.org >> https://lists.centos.org/mailman/listinfo/centos >> > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >
Seemingly Similar Threads
- how to resize a partition of a disk define as a physical volume
- how to resize a partition of a disk define as a physical volume
- how to resize a partition of a disk define as a physical volume
- how to resize a partition of a disk define as a physical volume
- how to resize a partition of a disk define as a physical volume