Has anyone tried taking an LVM snapshot of a running DB? And then reverting to the snapshot? I presume one would need to take a low level backup (i.e. using dd, not tar or cp) of the snapshot to preserve the precise FS layout, but are there any other issues?
I'm thinking of trying this slightly loony experiment on Postgres v 7.2.3 running on RedHat 7.3, with ext3 as the filesystem. The only 'gotchas' I can think of at the moment are:
1. the need to preserve the FS layout precisely
2. the minor pauses that occur while LVM freezes the FS to bring the snapshot online and offline.
3. the need to have the data directory and the pg_xlog directory on the same logical volume so they get snapshotted together
4. the fact that the on-disk data is much larger than the output of pg_dump, so backing up the snapshot will require quite a bit of IO
Any others I've missed? If it works then it'd be a fairly neat way to keep a recent consistent copy of the DB around without having to run pg_dump every 10 minutes, which chews CPU like nobody's business.
Thanks in advance for any comments.
Matt
Matt Clark
Ymogen Ltd
matt@ymogen.net
corp.ymogen.net