[aklug] Re: periodic LVM snapshots

From: Shane R. Spencer <shane@bogomip.com>
Date: Fri Nov 26 2010 - 18:07:11 AKST

On 11/25/2010 05:02 PM, Christopher Howard wrote:
> I've used LVM for a long time but never snapshots. I want to start making periodic snapshots of my system LV so that I can roll back quickly if I install a bad package or delete an important config file or something like that. Probably a new snapshot every two weeks, or maybe once a month.

LVM snapshots have a buffer size. Unless you set that buffer size to the maximum amount
of data you think you will need until you do a new snapshot, or resize it as needed
periodically, your snapshots will expire as you change data on either the snapshot or the
parent volume.

> But I'm not clear from reading the manual pages: do I have to create a /new/ snapshot every time, and delete the old one? Or is there some command to sync (i.e., erase) a snapshot and have it start tracking changes afresh?

The snapshot is a point in time of the parent volume. You would have to delete it to get
enough space back. You can create a new snapshot with a different name.. remove the old
snapshot.. then rename or not the new snapshot. Or keep both....

Check out rsnapshot. rsync based hard link snapshot system (Time Machine seems based
around this) that simply creates a new tree full of hard links then rsyncs on top of it
removing changed files before transferring them. The act of removing the file first
before syncing in a new revision simply removes the hard link to another tree therefore
not overwriting all files with that same inode. It's what you are attempting to do.

FWIW.. I use rsnapshot in several environments.. and I use LVM snapshots to create a point
in time of a filesystem I want to use rsnapshot on and then I remove the LVM snapshot.
This lets me flush and write lock SQL tables and do other evil things before I attempt to
do an rsync (which takes too long to determine changes for large sets of data).

- Shane

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Fri Nov 26 18:07:21 2010

This archive was generated by hypermail 2.1.8 : Fri Nov 26 2010 - 18:07:21 AKST