[linux-lvm] Do we have a way to clone the customer lvm2 environment?

Zdenek Kabelac zkabelac at redhat.com
Thu Mar 12 09:36:01 UTC 2020

Dne 12. 03. 20 v 5:54 Gang He napsal(a):
> Hi Guys,
> Sometimes we encountered some lvm2 meta-data damage (by lvm2 commands) problems.
> Do we have a way to clone (or dump) the customer lvm2 environment? such like file system e2image tool.
> for example, we can dump each pv(meta data + data(with file hole)) to a file,
> next we can rebuild the cloned lvm2 environment in local machine.
> then, we can verify the fix in local machine with the tentative rpms before give them to the customers.
> Any suggestions for this kind of case?


Such 'clone' of layout (without actual data) would only work with some basic 
lvm2 segtypes  (linear/stripe).
There is no easy way to 'clone' i.e. thin-pools, raids, caches, snapshots...)

All these complex type have it's own kernel metadata stored with metadata 
device which are 'invisible' to lvm2.

Also what would be a 'clone' a thin-pool with thin LVs without meaningful data 
right ?

ThinLV has an DeviceId which needs to match with kernel thinpool metadata.

Raid legs have their own metadata keeping internal state of raid device....

So my advice how to handle such case is to analyze existing 'lvs' output - see 
which devices likely do matter for actual 'cloning' and just recreate them
with proper lvcreate commmand.

The other way is to use plain 'DD' mechanism for the whole disk.



More information about the linux-lvm mailing list