|Vitaliy Filippov 91c5efcbe7||5 months ago|
|Makefile||1 year ago|
|README.md||5 months ago|
|backup.sh||5 months ago|
|era_apply.c||1 year ago|
|era_copy.c||1 year ago|
|zz_dm-era.sh||5 months ago|
dm-era is a Device Mapper target that acts as a proxy to an existing block device, like dm-linear, but also keeps track of which blocks were written to. It is included in mainline Linux kernel since 3.15.
era_copy parses dm-era metadata from
era_invalidate output and saves changed blocks into a stream
that you can save to a file or copy over network.
era_apply takes era_copy output and applies it to a file (or to a block device) to create a mirror of the original device.
With dm-era and these two small utilities you can perform incremental backups of raw block devices without the need for a COW FS, LVM or a storage hypervisor. dm-era almost doesn’t hurt performance and seems to handle fsyncs correctly.
dd if=/dev/zero of=<META_PARTITION> bs=1048576
ERA_DEVICE_NAMEin it. Use partition IDs (
/dev/disk/by-partuuid/*for GPT partitions,
/dev/disk/by-id/md-uuid-*for mdadm, etc) to be safe because dm-era doesn’t check if you supply correct partitions to it.
/etc/fstaband change your actual device to
/dev/mapper/<ERA_DEVICE_NAME>, for example
update-initramfs -u -k all.
GRUB_CMDLINE_LINUX="root=/dev/mapper/root_era"and refresh grub config with
apt-get install thin-provisioning-toolson your target host.
make installfrom this repository) on both hosts (target host and backup host).
ssh root@host "e2image -f -p -ra /dev/mapper/root_era - | gzip" | gzip -d | cp --sparse=always /dev/stdin rootfs.bin.
backup.shto perform incremental backups of the dm-era device over ssh from the backup host. Just change variables at the top of the script so it matches your device configuration.
It’s not a one-click solution, but it works :-)
GNU GPLv3.0 or later
Of course I don’t take any responsibility if you kill your data while trying to setup dm-era :-)