On 03/16/2012 02:53 PM Les Mikesell wrote:
On Fri, Mar 16, 2012 at 1:19 PM, ken gebser@mousecar.com wrote:
I find that LVM snapshots are useful to insure data integrity. for example, I backup my mysql databases by stopping the mysql server, taking an LVM snapshot and restarting it. The whole snapshot process probably takes less then 15 seconds. Then I backup the snapshot LVM and it doesn't matter how long it takes. You must make sure that your snapshot volume is large enough that you won't run out of space before deleting the snapshot.
Thanks for the tip. The details of how a snapshot works has long evaded me. For example, when files are open but unsaved, what is written to the snapshot...? And is the entire contents of a file recorded by the snapshot... or something else?
LVM snapshots just present a view of the disk as it was when the snapshot was taken. To do that, whenever you write to the disk with a snapshot active, it first copies the old data into the snapshot. Blocks that don't change don't need to be copied. This doesn't do anything by itself to make the files consistent, but you might stop your apps momentarily, make the snapshot, then let them run again while the snapshot is being backed up.
Thanks, Les! That fleshes the process out a little more for me. But what does it mean that a snapshot is "active"?