[linux-lvm] Snapshots and disk re-use

Les Mikesell lesmikesell at gmail.com
Wed Feb 23 20:03:35 UTC 2011


On 2/23/2011 1:39 PM, Stuart D. Gathman wrote:
> On Wed, 23 Feb 2011, Les Mikesell wrote:
>
>>>> Actually, if you never (or rarely) write to the origin, lots of snapshots
>>>> should be fine.
>>>
>>>> But every write to the origin will first copy the
>>>> original origin data to every snapshot.
>>>>
>>> Why would origin data be copied over to the snapshot after the snapshot
>>> has been created? Surely the point of a snapshot is to have "frozen" data?
>>
>> Yes, is the way this actually works explained somewhere?  I would have
>> expected the 'copy-on-write' blocks to be copied only on the side where the
>> write is happening and relocated instead of rewriting all the snapshots that
>> might be outstanding with the old data.
>
> It should be obvious when you think about it.

Well, maybe if you've never used a NetApp.  They seem to make a big deal 
out of only writing once.

> You go to write to the origin,
> to a block you've never written to since creating the snapshot.  Where
> are you going to save that original data?  Why in the *-cow LV of course.
>
> The origin and snapshot LVs do not have data of their own.  The
> origin data is in *-real, and new writes to the origin first read *-real,
> write *-cow, then finally do the new write to *-real.  This read-write-write
> cycle is tolerable for a single snapshot, but quickly gets out of hand
> with multiple snapshots.

Which is why re-writing stuff that was already correct and not being 
modified doesn't make much sense.

> Writes to the snapshot, on the other hand, simply write to the *-cow with
> some mapping, no need to update the origin.

I would have guessed that snapshots were read-only. If you can write, it 
isn't really a snapshot, is it?

-- 
   Les Mikesell
     lesmikesell at gmail.com




More information about the linux-lvm mailing list