Fix notes

master
Vitaliy Filippov 2020-08-14 16:25:49 +03:00
parent 25e8b48452
commit 3bdfbb1bbe
2 changed files with 17 additions and 13 deletions

View File

@ -22,20 +22,22 @@ and seems to handle fsyncs correctly.
on disk at a time, but anyway, a 512 MB or 1 GB partition will be more than enough. on disk at a time, but anyway, a 512 MB or 1 GB partition will be more than enough.
For example you can shrink the main partition a bit and add the dm-era partition after it. For example you can shrink the main partition a bit and add the dm-era partition after it.
2. Zero out the new metadata partition: `dd if=/dev/zero of=<META_PARTITION> bs=1048576` 2. Zero out the new metadata partition: `dd if=/dev/zero of=<META_PARTITION> bs=1048576`
3. Copy `local-block_dm-era.sh` to `/etc/initramfs-tools/scripts/local-block` 3. Copy `zz_dm-era.sh` to `/etc/initramfs-tools/scripts/local-block`
and adjust `DATA_DEVICE`, `META_DEVICE` and `ERA_DEVICE_NAME` in it. and adjust `DATA_DEVICE`, `META_DEVICE` and `ERA_DEVICE_NAME` in it.
Use GPT and partition UUIDs to be safe because dm-era doesn't check Use partition IDs (`/dev/disk/by-partuuid/*` for GPT partitions, `/dev/disk/by-id/md-uuid-*` for mdadm, etc)
if you supply the correct partition to it. to be safe because dm-era doesn't check if you supply correct partitions to it.
4. Edit `/etc/fstab` and change your actual device to `/dev/mapper/<ERA_DEVICE_NAME>`, 4. Add `dm_era` to `/etc/initramfs-tools/modules`.
5. Edit `/etc/fstab` and change your actual device to `/dev/mapper/<ERA_DEVICE_NAME>`,
for example `/dev/mapper/root_era`. for example `/dev/mapper/root_era`.
5. Repeat it for more partitions if you want. 6. Repeat it for more partitions if you want.
6. If you do it for the root partition also change `/etc/default/grub`: 7. Run `update-initramfs -u -k all`.
8. If you do it for the root partition also change `/etc/default/grub`:
`GRUB_CMDLINE_LINUX="root=/dev/mapper/root_era"` and refresh grub config with `update-grub`. `GRUB_CMDLINE_LINUX="root=/dev/mapper/root_era"` and refresh grub config with `update-grub`.
7. Reboot. 9. Reboot.
8. Install dm-era tools (`era_invalidate`) with `apt-get install thin-provisioning-tools` on your target host. 10. Install dm-era tools (`era_invalidate`) with `apt-get install thin-provisioning-tools` on your target host.
9. Install `era_copy` and `era_apply` (`make install` from this repository) on both hosts (target host and backup host). 11. Install `era_copy` and `era_apply` (`make install` from this repository) on both hosts (target host and backup host).
10. Do an initial full partition backup with block-level copy. 12. Do an initial full partition backup with block-level copy.
11. Now you can use `backup.sh` to perform incremental backups of the dm-era device 13. Now you can use `backup.sh` to 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 over ssh from the backup host. Just change variables at the top of the script so it matches
your device configuration. your device configuration.

View File

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
# Put into /etc/initramfs-tools/scripts/local-block
set -e set -e
@ -18,7 +19,8 @@ esac
modprobe dm-era modprobe dm-era
DATA_DEVICE=/dev/disk/by-partuuid/ca313f78-7911-994b-b465-5cda9a3ceafb DATA_DEVICE=`realpath /dev/disk/by-partuuid/ca313f78-7911-994b-b465-5cda9a3ceafb`
META_DEVICE=/dev/disk/by-partuuid/be47b5e2-1587-1243-9c5f-f9e165df5c30 META_DEVICE=`realpath /dev/disk/by-partuuid/be47b5e2-1587-1243-9c5f-f9e165df5c30`
ERA_DEVICE_NAME=root_era ERA_DEVICE_NAME=root_era
[ -z "$DATA_DEVICE" -o -z "$META_DEVICE" ] && exit 0
dmsetup create $ERA_DEVICE_NAME --table "0 `/sbin/blockdev --getsz $DATA_DEVICE` era $META_DEVICE $DATA_DEVICE 1024" dmsetup create $ERA_DEVICE_NAME --table "0 `/sbin/blockdev --getsz $DATA_DEVICE` era $META_DEVICE $DATA_DEVICE 1024"