[linux-lvm] Steps to "clone" a volume group

Alasdair G Kergon agk at redhat.com
Thu Nov 22 16:05:40 UTC 2007


Fine for testing, but if running this on a production system
you should tweak this so that your machine remains bootable
should it crash at any stage of the procedure.

On Thu, Nov 22, 2007 at 03:18:43PM +0000, Bryn M. Reeves wrote:
> 1. Deactivate the VG
 
Not necessary if done as follows.

> 2. Create the cloned PV(s)
> 3. For each original PV, create a filter entry in /etc/lvm/lvm.conf to
> temporarily mask the PV from the LVM tools.

Swap order there: the system's lvm.conf should mask out the new PVs
*before* they get created.

> Once the filters are set up, remove the LVM persistent cache:

Never required: the pvscan will do that for you.

Create a temporary alternative lvm system directory holding 
a copy of lvm.conf that has filters to accept only
the new copies of the PVs and set LVM_SYSTEM_DIR to use it.

Only now do step 2.

> 4. Modify the cloned volume group name, ID and physical volume IDs to
> avoid name and UUID clashes between the original and cloned devices:

(with LVM_SYSTEM_DIR set)
 
> 5. Remove filtering rules & verify both VGs co-exist correctly

discard LVM_SYSTEM_DIR env var & directory

Alasdair
-- 
agk at redhat.com




More information about the linux-lvm mailing list