[linux-lvm] pvresize patch pending

Zak Kipling zak.kipling at cantab.net
Fri Oct 28 20:14:43 UTC 2005

Alasdair G Kergon wrote:

> If the PV belongs to a VG (the only case that matters - pvcreate
> is quite adequate otherwise), after the pv_write (equivalent
> to 'pvcreate'), more fields need updating I think - see 
> add_pv_to_vg() - incl. the various extent counters and
> the segment lists.  

Indeed. I've recently been working on an implementation myself 
(primarily because I wanted to grow a live PV on my own system), which 
I've attached in its current (somewhat rough, but seemingly working) 
state as a patch against CVS HEAD.

In addition to updating pv->size it also adjusts pv->pe_count, 
pe->segments, vg->extent_count and vg->free_count.

In the shrinking case, it checks that the removed extents are free 
(though ideally it would relocate them elsewhere in the VG, like pvmove.

There is no requirement for LVs to be deactivated, as the actual LVs 
don't get touched during the operation.

I've tested it (both growing and shrinking) on loop devices containing 
small LVM systems, and successfully used it to grow the PV housing a 
running system (including the root filesystem).

The main issues I'm not sure about are:

* Support for metadata formats other than format_text.

* Support for more than one mda on a PV (I think it will currently 
clobber ones at the end of the PV, since it assumes all space after 
pe_start is available for extents).

I hadn't planned on posting it quite yet, but since the discussion has 
started it might be useful.

Zak Kipling.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-pvresize.diff
Type: text/x-patch
Size: 14708 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20051028/b747f68e/attachment.bin>

More information about the linux-lvm mailing list