[linux-lvm] Resizing underlying LVM partition after cloning to bigger disk

Radu Rendec radu.rendec at mindbit.ro
Fri Mar 4 08:41:55 UTC 2011


On Thu, 2011-03-03 at 15:18 -0500, Stuart D. Gathman wrote:
> On Thu, 3 Mar 2011, Scott Arthur wrote:
> 
> > Partition Table: msdos
> > 
> > Number  Start   End     Size    Type      File system  Flags
> >  1      32.3kB  296MB   296MB   primary   ext4         boot
> >  2      296MB   1000GB  1000GB  extended
> >  5      296MB   1000GB  1000GB  logical                lvm
> > 
> > I'm obviously wanting to expand the LVM partition to fill the remaining 1TB
> > of space.
> > 
> > Am I able to simply use parted to resize the partition before doing a
> > pvresize etc?
> > 
> > Or is it risky to resize the underlying LVM partition?

I wouldn't do that. Instead, I would create a new logical partition,
"format" it as lvm physical volume and then extend the volume group to
use this partition as well.

I think this can be safely done like this:

* turn off lvm;
* note down the exact starting and ending *sector* of partition 5 (using
fdisk -lu)
* use fdisk and delete partition 5 and 2, then re-create partition 2 up
to the full disk size
* re-create partition 5 making sure it's on exactly the same starting
and ending sector as it was before
* create new partition 6

> You are getting to a size where msdos partition tables are risky.
> Don't they crap out at 2TB?

They do. But the "2TB" disk is actually 2000GB, which is safe (it takes
more than 2048GB to run into trouble with m$dos partitions).

Best regards,

Radu Rendec





More information about the linux-lvm mailing list