Could we use LVM snapshots to backup database servers? Or we can only use it for file system backups?
-
You can do it when you prepare the state of the DB before the "freeze" (see answers below) - I just want to add that the LVM snapshot should not be your only backup then because there is some more work involved when going to restore the data back. – initall Apr 05 '11 at 09:12
2 Answers
Yes, for MySQL use or look at mylvmbackup.
I use it as part of my backup procedure. I also run Master - Master Replication and mylvmbackup makes fixing replication a pleasure.
In my experience, yes. The essence of the process is getting the database into a position where the on-disc contents are self-consistent and from which the database could easily recover, if not simply continue, and to use the snapshot facility to "freeze" that image for backup whilst in fact allowing the database to return to normal operation.
With an Oracle / NetApp combination of database and file server, if memory serves, this involves putting the Oracle tables into hot-backup state before taking a WAFL snapshot; other DB/FS combinations will have their own nomenclature, but the underlying principle is the same.
Once the database is in its stable on-disc image position, take the snapshot, and release the database from this constrained state. Then the file system's snapshot facility can be used to roll the "frozen" on-disc image to tape or other backup medium in a leisurely manner, with the snapshot being released once the roll-off is completed.

- 79,770
- 20
- 184
- 232