lvm snapshot for backup
I have a Xen server which hosts a DomU mail server. The DomU is on a LV.
I'd like to use snapshots to backup the DomU but have a few questions I hope people can clarify.
1) Chosing the filesystem
I can confirm that doing a snapshot of a running ext3 system will lead to errors when booting the snapshot. The errors don't seem to be major but I'd like to avoid any risk. I hear some people use XFS to get arround that by doing a xfs_freeze before the snapshot. What do you think, use, recommend?
I read the following:
Any help would greatly be appreciated.
It looks like the snapshot keeps a record of all changes done on the original LV from the time of the snapshot... but for what purpose?
A snapshot is not a mirror image of the target volume. It works more like a revision control system - the snapshot volume keeps a list of changes that have to be undone on the target volume to take it back to the point the snapshot was taken.
Every change made to the target volume is recorded in the snapshot as the original is updated, so the snapshot volume grows in relation to update activity, eventually filling the snapshot volume. Once this happens there is no way to record new changes and LVM can no longer get back to the snapshot point and invalidates the snapshot volume rather than crash.
Using a snapshot for backup still requires that the target volume is "quiescent". In this case your mail server software must flush everything to disk and pause before taking the snapshot to ensure that you accurately capture the full application state rather than just what happens to be on disk at the time - LVM doesn't know about locking etc. The benefit is that the application can start running again as soon as the snapshot is taken. This is much quicker that a full backup or mirror operation.
Hope this helps.
Sorry for the late reply. Yes, most useful indeed.
I have a couple of questions left now, pointers to documentation are still welcome :)
If a snapshot is a point in time and is there to allow us to go back to the time of a snapshot...
After taking a snapshot:
1) If I want to run a test, do I run it on the original LV or the snapshot?
2) How do I use the snapshot to return to a state before the test was made (time of snapshot).
What I did was, snapshot, mount snapshot instead of original LV, if ok, remove snapshot and do the same on original LV... but it seems all wrong now.
The best documentation I have found is the LVM HOWTO at http://www.tldp.org/HOWTO/LVM-HOWTO/index.html - Section 3.8 "Snapshots" and 13.4 "Taking a Backup Using Snapshots".
For testing something out with LVM2, create the snapshot and mount it in place of the original, run the test and, if all went well, discard the snapshot, re-mount the original and run again for real.
This way you side-step the issue of rolling back the original volume as it is unchanged during the testing, just like a quick mirror/backup copy. So you are "doing the right thing".
Thanks for the reference and the thumbs up for my method. :)
|All times are GMT -5. The time now is 06:44 PM.|