[linux-lvm] pvextend?

Heinz J . Mauelshagen mauelshagen at sistina.com
Sun Feb 24 04:08:02 UTC 2002


On Sun, Feb 24, 2002 at 02:56:40AM -0600, Chris Abbey wrote:
> Howdy all,
> 	I've searched through the archives and how-to's but I see
> no mention of this concept anywhere. I'm hoping someone can point
> me twoard a tool to accomplish it.
> 
> 	What I have today is one VG with the following PVs:
> 
> PV Name (#)           /dev/sda3 (1)
> PV Status             available / allocatable
> Total PE / Free PE    1666 / 172
> 
> PV Name (#)           /dev/sdb2 (2)
> PV Status             available / allocatable
> Total PE / Free PE    1666 / 322
> 
> The drives that these PVs come from are allocated as such:
> 
>    Device Boot    Start       End    Blocks   Id  System
> /dev/sda1   *         1       131   1052226   83  Linux
> /dev/sda2           132       163    257040   82  Linux swap
> /dev/sda3           164       588   3413812+  8e  Linux LVM
> /dev/sda4           589      1105   4152802+   c  Win95 FAT32 (LBA)
> /dev/sdb1             1       163   1309266    b  Win95 FAT32
> /dev/sdb2           164       588   3413812+  8e  Linux LVM
> /dev/sdb4           589      1106   4160835   83  Linux
> 
> 	I want to nuke sda4 and sdb4 and add the space they
> occupy to the PVs on sda3 and sdb2.


Well, we don't have a pvextend (so far ;-)

> If these were ext2 fs'
> or were striped together with md this would be trivial: open
> fdisk, delete the last two partitions create a new, unified,
> partition in their place, write the table, repeat on the other
> drive, then use e2resize to push the filesystems into the new
> space. But how do I do this with PVs? I assume the fdisk
> adjustment will still be needed, but what is the corresponding
> e2resize command for a PV? Or will they just see the added
> space and grow to fit?

No pvextend :( Should start to code it...

But rather than the way below, why don't you "pvcreate /dev/sd[ab]4"
after setting their partition type to Linux LVM and vgextend them to
your VG? The metadata overhead given is very small compared to the device
sizes of sd[ab]4.
The only thing you need to take care of is, that you don't create striped
LVs on one physical disk.

If you want to create some of those, you need to use

lvcreate -L YourSize -i 2 -n YourLVName YourVG /dev/sda3 /dev/sdb2

- or -

lvcreate -L YourSize -i 2 -n YourLVName YourVG /dev/sda4 /dev/sdb4

to avoid striping over to partitions of the same physical disk.

> 
> 	I have dreamed up a rather ugly way to accomplish
> this, kinda-sorta.... I could create a second PV on one
> of the drives, say as sdb4... then pvmove the PV from the
> other drive into that, then create a new PV on the first
> drive of the full size, then add that to the VG, then pvmove
> the data from both of the small PVs into the large one, then
> pvremove them and create a replacement large PV in their place
> and add it to the VG. The end result of that though would be
> that all my data was on one drive... the advantage of striping
> over two drives would be shot to hell. I measured a healthy
> performance boost when I moved to striping two drives, I'm not
> keen to loose that, and as far as I can tell, there is no tool
> to rebalance the PEs over several PVs. Or did I miss something?
> 
> 	Any suggestions appreciated.
> 
> 
> _______________________________________________
> linux-lvm mailing list
> linux-lvm at sistina.com
> http://lists.sistina.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html

-- 

Regards,
Heinz    -- The LVM Guy --

*** Software bugs are stupid.
    Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Sistina Software Inc.
Senior Consultant/Developer                       Am Sonnenhang 11
                                                  56242 Marienrachdorf
                                                  Germany
Mauelshagen at Sistina.com                           +49 2626 141200
                                                       FAX 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-




More information about the linux-lvm mailing list