Amazon EBS backup + LVM
No-nonsense steps:
Backup mechanism:
- Tag volumes of the attached instance with appropriate
volume_group
names. - For each volume group, take lvm snapshot
- For each ebs in the volume group, take ebs snapshot.
- Delete lvm snapshot as soon as ebs snapshot process started.
- Tag ebs snapshots with appropriate volume_group names and timestamps, to help yourselves restoring.
Restore mechanism:
- Create new instance. Make volume group.
- Revert to the LVM snapshots.
umount /dev/mapper/volume_group
lvconvert --merge /dev/volume_group/snapvolcpm
mount /dev/mapper/volume_group /volume_mountpoint
These commands unmount the volume, merge the snapshot with the main volume, and then re-mount it.
With this approach, you are able to perform backup using EBS snapshots, with all their advantages, and still make sure that the backup is consistent in the volume manager level.