Synchronization of volume snapshots when doing whole system backups
- by intuited
Is there a way to guarantee consistency across volumes when doing backups from LVM snapshots? Consider this scenario:
Some system upgrade is in progress. It will write some files to the /usr volume, and once completed, will record success in the /var volume.
As the upgrade is just about complete, I run a backup script that creates snapshots of the /usr and /var volumes, along with the rest of the system's volumes, and proceeds to create backups from those snapshots.
Just before the upgrade's last write/flush on the /usr volume completes, the backup script takes its snapshot of /usr.
That write completes, and the upgrade operation's success is quickly recorded in the nebulous depths of /var.
The backup script takes a snapshot of /var.
The backup script creates backups from the snapshots it has, er, snapshotted.
So the result of all of this tomfoolery is that the resulting /usr backup contains a file which is missing a few bits, and the /var backup contains metadata indicating that that file is complete and approved for use.
Without delving into the details of which operating systems' system upgrade systems would be unfazed by such trifles, is there a way to avoid such problems? At the least this seems like it could cause some application to fail unexpectedly after restoration of such a backup.