[linux-lvm] Snapshots and disk re-use

Stuart D. Gathman stuart at bmsi.com
Wed Feb 23 19:39:31 UTC 2011


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.  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.

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

Reads from origin simply read from *-real.  Reads from snapshot, read
from *-cow if mapped, and from *-real otherwise.

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.




More information about the linux-lvm mailing list