archive mirror
 help / color / mirror / Atom feed
From: Zdenek Kabelac <>
To: "Tomas Dalebjörk" <>
Cc: LVM general discussion and development <>
Subject: Re: [linux-lvm] how to convert a disk containing a snapshot to a snapshot lv?
Date: Wed, 22 Dec 2021 11:40:27 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Dne 21. 12. 21 v 17:12 Tomas Dalebjörk napsal(a):
> Thanks for explaining all that details about how a snapshot is formatted on 
> the COW device.
> I already know that part.

Well your messaging is then somewhat confusing.

> I am more interested in how the disk containing the COW data can be merged 
> back to an LV volume.
> The second part only mentioned that it is possible, but not which steps are 
> involved.
> As documented in the manual.
> To split a snapshot from its origin (our words detach) one can use:
> lvconvert --splitsnapshot vg/s1
> Right?
> To reverse that process, according to the manual; one can use:
> lvconvert -s vg/s1
> Right?
> But as I mentioned before, this requires that the vg/s1 exists as an object in 
> the LVM metadata.
> What if you are on a new server, that does not have vg/s1?
> How to create that object or whatever you like to call this on the server?
> The only way I got it is to use the
> vgextend
> lvcreate
> lvconvert --splitsnapshot
> And now reattach it, so that the actual merge can happen.
> The object should exist now, so that the command: lvconvert -s vg/s1 can work

There is no problem with reattaching existing COW to any other LV -
it's plain  'lvconvert  -s -Zn -c xxx vg/origin   vg/snapcow'

this will rejoin former origin with former COW volume and avoids 'zeroing' 
metadata stored on COW.

But to have this usable - there must have been NO write access to the origin 
between the moment your snapshot was 'split' and 'reattached'
and it's documented in  'man lvconvert'

> Or how can the object vg/s1 be created so that it can be referenced to by the 
> lvconvert command?
> The disk is formated as a COW device, and contains all of the data.
> So how hard can it be to just reattach that volume to an empty or existing LV 
> volume on the server?

There is no problem with this - however your  provided case just shown you 
have very small amount of data stored in snapshot.

So while snapshot has large size - it's been mostly unoccupied with data - so 
any merge into  'clean' origin is kind of meaningless in this particular case.

> If it works on same server, why can't it work on any other new servers, as the 
> COW device contains ALL the data needed (we make sure it contains all the data)
> If you want to give it a try, just create a snapshot on a specific device
> And change all the blocks on the origin, there you are, you now have a cow 
> device containing all data needed.
> How to move this snapshot device to another server, reattach it to an empty lv 
> volume as a snapshot.

I'm aware how this works - being lvm2 developer...

I'm just trying to explain there is better and simpler way how to reach your 

Simply take a 'time consistent' snapshot of your origin.
(So it does not change while you take a 'dd' copy)

Take a 'DD' copy of such stable snapshot to a new LV.
And restore this 'copied' LV on your 2nd. server.

I simply don't follow why would you want to complicate all of this with 
snapshot merging - makes no sense and just cause a massive slowdown....



linux-lvm mailing list
read the LVM HOW-TO at

  reply	other threads:[~2021-12-22 10:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-19 16:43 Tomas Dalebjörk
2021-12-20 14:51 ` Phillip Susi
2021-12-21 13:46 ` Zdenek Kabelac
2021-12-21 14:44   ` Tomas Dalebjörk
2021-12-21 15:30     ` Zdenek Kabelac
2021-12-21 16:12       ` Tomas Dalebjörk
2021-12-22 10:40         ` Zdenek Kabelac [this message]
2021-12-28  5:04         ` Stuart D Gathman
2021-12-28  6:40           ` Tomas Dalebjörk
2021-12-29 13:35             ` Stuart D Gathman
2021-12-21 19:23     ` Phillip Susi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \
    --subject='Re: [linux-lvm] how to convert a disk containing a snapshot to a snapshot lv?' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).