2

I read What does an LVM2 Snapshot contain? and LVM Snapshot confusion.

What I'm trying to figure out is if there is a way to create a copy of an LVM snapshot for use with different Xen VMs. I know that it isn't built into LVM (yet), but I was wondering if it might (or might not) work like this:

  1. Create Logical Volume LV1
  2. Create Snapshot1 of LV1 (100MB)
  3. Create Snapshot2 of LV1 (100MB)
  4. dd if=Snapshot1 of=Snapshot2
  5. Use Snapshot1 and Snapshot2 both for R/W operations with Xen, use LV1 read-only.

Would it work or would it fail horribly in hard-to-detect ways? Any other suggestions to approach this? I guess that I could also create a second Logical Volume LV2 and copy the content of Snapshot2, but that would take up more space for PEs.

Solution:

In the meantime I found a way to do it using LVM2 thin volumes: https://wiki.gentoo.org/wiki/LVM#LVM2_Thin_Snapshots

  • What's the dd for? – Michael Hampton Oct 11 '13 at 15:42
  • Well, the idea is that I have made changes to Snapshot1 after creating it. I now want Snapshot2 to start out with the same content as Snapshot1, so I use dd initially to clone these two devices. – heipei Oct 11 '13 at 17:20
  • Why don't you ... you know ... make a snapshot? – Michael Hampton Oct 11 '13 at 17:23
  • LVM2 does not yet support snapshots of snapshots. First thing I tried obviously ;) – heipei Oct 11 '13 at 21:35
1

The idea may be reasonable but dd is the killer for all efforts. You will not get neither speed nor space-saving.

With differential coping at least space-saving may available. Can try lvmsync to do It.

Another option is ZFS (zfsonlinux) where you can do clones from snapshots. But I am not sure about ZVOL perfomance on Linux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.