LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   pvextend not working (https://www.linuxquestions.org/questions/linux-software-2/pvextend-not-working-4175455542/)

rnbguy 03-25-2013 02:48 PM

pvextend not working
 
Hi All,

I have added 100GIG of disk to one of my LUNs however after a powermt scan i'm still not able to extend the physical from 100GIG to 200GIG.

The confusing thing is I can see the full disk in 'fdisk -l':

Code:

Disk /dev/emcpowerb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

        Device Boot      Start        End      Blocks  Id  System
/dev/emcpowerb1              1      13054  104856223+  8e  Linux LVM


... But my physical volume won't extend:
Code:

pvresize /dev/emcpowerb1
  Physical volume "/dev/emcpowerb1" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized

[root@HN-Prod-MySQL01 ~]# pvscan
  PV /dev/emcpowerb1    VG vglog01    lvm2 [100.00 GB / 50.00 GB free]



any help would be great on this?

kbp 03-25-2013 06:31 PM

Looks like you haven't extended the partition
Quote:

Disk /dev/emcpowerb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/emcpowerb1 1 13054 104856223+ 8e Linux LVM
Actually I might be wrong there, can you display it in sectors rather than cylinders?

haertig 03-25-2013 11:54 PM

Your total disk space may be 200Gb, but that first partition is only 100Gb. pvresize can't grow the PV to larger than the partition it is made out of.

You can either:

(1) Resize the partition larger (using fdisk ?), then run pvresize. Since I have never used pvresize personally I am not familiar with this procedure. I wouldn't think you'd have to do anything with the VG at this point, and could simply grow your LV(s) now. But having never used pcresize, I cannot say for sure without doing some research.

-or-

(2) Leave the first partition as it is, make a second partition out of the rest of your disk using fdisk, mark that second partition as a PV with pvcreate, then add that new PV to the existing VG with vgextend, then grow your LV(s) (specific steps for growing an LV vary depending on filesystem type).

======

Method (2) is much safer IMHO. I have never liked resizing partitions while trying to keep their data intact. That gives me the willies just thinking about it. I did it once or twice in Windows using "Partition Magic" years ago, and it worked, but I was nervous the entire operation even though I had everything well backed up before starting. I have used method (2) many many times - adding hard disks, creating new partitions, marking those new partitions as PV's, adding those new PV's to existing VG's, and then extending LV's.

kbp 03-26-2013 11:19 PM

I've used method (1) before but I had backups and it wasn't a production system so I wasn't too concerned

- note the partition start block and type
- using fdisk delete the partition and recreate starting at the same start block but finishing at the end
- ensure the new partition has the same type as before
- 'w' to save changes

Then continue on with pvresize /dev/emcpowerb1

* no responsibility accepted for any loss of data or productivity!

rnbguy 03-30-2013 04:28 AM

Brilliant replies, I will go with option 2 above but will keep notes of option 1 for future reference, thanks guys.

it would be good if the initial partition could be dynamic so whenever disk of the original partition grew a simple resize could take place

kbp 03-30-2013 05:53 AM

You can just use the whole device without partitioning at all, but I never do it this way as it can be confusing for people to see no partition. I have a vague memory that it will automatically resize if you increase the volume, but you should probably read up to confirm.


All times are GMT -5. The time now is 06:32 AM.