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

Stuart D. Gathman stuart at bmsi.com
Fri Mar 4 13:50:49 UTC 2011


On Fri, 4 Mar 2011, Radu Rendec wrote:

> > > 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

If you are going to do all that risky "remember the sector" stuff anyway, then
just resize the partition.  "pvresize" works perfectly well for the PV.

You should always use pvresize when convenient.  LVM is not smart enough
to know when PVs are actually on the same spindle.  (Could be done
with enhancements to the metadata.)  So it will happily stripe,
put mirror legs, etc, between the apparently separate PVs.

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.




More information about the linux-lvm mailing list