[linux-lvm] pvresize patch pending

Alasdair G Kergon agk at redhat.com
Sat Oct 29 20:08:43 UTC 2005

Are any of you are interested in working on something else in
a related area of the code?

New tool:
  lvimport - Bring an existing filesystem on a partition under LVM control

e.g. you have an ext3 filesystem on /dev/hda3 and you want to turn it
into an LV without moving it.

Requires an existing VG with at least one pre-existing mda.
 (could be from metadata/dirs of course)
Involves (equivalent of) running pvcreate -Zn --metadatacopies 0 
on the partition,
probably with --labelsector 1 (may depend on fs),
changing pe_start to 0,
getting the last sector used by the filesystem (add a new helper 
function to fsadm to give this info based on filesystem type?),
vgchange --physicalextentsize if necessary so that the entire 
filesystem is enclosed by PEs,
adding the new PV to the VG,
creating an LV enclosing the filesystem.

Now the PV label is within the new LV - but stored in a sector
that the filesystem doesn't use.

There might be a case for reducing the size of the filesystem
slightly before doing this if it's close to the end of the
partition, so that the pe size isn't too small.  
[The number of PEs is 32-bits, so tiny PEs put constraints
on the VG size - need to make sure the code detects problems here,
or consider implications of switching to 64 bits.]

Ensure none of the tools can leave you with a VG with no mdas
(eg split off the new PV with vgsplit)

Require filesystem to be unmounted first.

agk at redhat.com

More information about the linux-lvm mailing list