/ Engineering

Amazon EBS backup + LVM

No-nonsense steps:

Backup mechanism:

  1. Tag volumes of the attached instance with appropriate volume_group names.
  2. For each volume group, take lvm snapshot
  3. For each ebs in the volume group, take ebs snapshot.
  4. Delete lvm snapshot as soon as ebs snapshot process started.
  5. Tag ebs snapshots with appropriate volume_group names and timestamps, to help yourselves restoring.

Restore mechanism:

  1. Create new instance. Make volume group.
  2. 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.