[linux-lvm] ANNOUNCE: an experimental implementation of snapshot merging
Mikulas Patocka
mpatocka at redhat.com
Thu Jun 5 15:09:11 UTC 2008
On Wed, 4 Jun 2008, Brian J. Murrell wrote:
> On Wed, 2008-06-04 at 07:07 -0400, Mikulas Patocka wrote:
>>
>>> A pedantic example would be to create an origin, O1 and then a snapshot
>>> of O1 called S1. Make a bunch of changes to S1 and then create another
>>> snapshot of O1 called S2 and then block copy from S1 to S2 (presumably,
>>> although I don't know for sure, S2 only contains the same changed blocks
>>> as S1).
>>
>> No, if you block copy over /dev/vg/snapshot device, it will contain all
>> the blocks (regardless if they differ from the origin or not).
>
> So my premise of copying from S1 to S2 and the result that S2 would only
> contain real blocks for what differs to the origin and pointers for
> blocks that don't differ is false?
Yes, it's false.
If you overwrite a snapshot, you always allocate new exceptions of the
written blocks --- regardless if the blocks differ from the origin or not.
>> There could theoretically be compare function, testing if the write equals
>> to actual data and dropping the write eventually --- but it would be too
>> much coding overhead for too little practical advantage.
>
> For certain use cases I think this would be a great advantage. Think
> about this:
>
> 1. Create an LV and install a linux distro into it.
> 2. Make a snapshot and customize to the settings for a given
> configuration (i.e. a group of hosts)
> 3. Now I want to make an (initially) identical (to the snapshot
> customized in step 2) snapshot for each node in that
> configuration
>
> Being able to do:
>
> # lvcreate -L5G -n pristine node_group
> [ install linux distro into /dev/node_group/pristine ]
> # lvcreate -s -L$size -n config1_master pristine
> # for node in $nodelist; do
>> lvcreate -s -L$size -n $node pristine
>> dd if=/dev/node_group/config1_master of=/dev/node_group/$node
>> done
>
> And have each of those snapshots be as efficient as config1_master.
You can do this if you copy the exception store (i.e. don't copy
/dev/vg/snap or /dev/mapper/vg-snap --- instead, copy
/dev/mapper/vg-snap-cow). Copy it to a new linear logical volume and then
use lvconvert -s to turn it into a snapshot. When you copy
/dev/mapper/vg-snap-cow, the snapshot and origin must be idle ---
otherwise you'd be copying data while it's being modified.
Mikulas
More information about the linux-lvm
mailing list