Re: LVM snapshots - Mailing list pgsql-admin

From Matt Clark
Subject Re: LVM snapshots
Date
Msg-id OAEAKHEHCMLBLIDGAFELGEDIDBAA.matt@ymogen.net
Whole thread Raw
In response to Re: LVM snapshots  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: LVM snapshots
List pgsql-admin
> Ragnar =?iso-8859-15?B?S2rDuHJzdGFk?= <postgres@ragnark.vestdata.no> writes:
> > So, basicly your database will be inresponsive for the time it takes to
> > take a snapshot. The time will depend on the size of the device, the
> > size of the pysical extents (the LVM "blocks") and the raw disk
> > performance, but typically we're talking about periods shorter than a
> > second.
>
> We are?  On what size database?  Surely it takes longer than a second to
> copy a reasonable-size database.

Ah, a misconception.  The terminology is confusing.  What is stored on the 'snapshot volume' is not a copy of the
'frozenvolume', 
but only the writes to the frozen volume.  When the 'snapshot volume' is unmounted those updates then get copied back
tothe 'frozen 
volume' which is then unfrozen.  The 'snapshot volume' therefore only needs to be big enough to store as much data as
willbe 
written to (or rather as many blocks as will be altered on) the frozen volume while the snapshot is in place.

So when you take a snapshot there is no data to be copied, and when you release a snapshot some data needs to be
writtenback. 
Since the data to be copied is nice whole disk blocks and no metadata has to be altered that's a pretty fast operation.




pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: LVM snapshots
Next
From: Tom Lane
Date:
Subject: Re: LVM snapshots