From 3bdfbb1bbe6d2ef588fe7a6f67ecf314a6ab3e30 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 14 Aug 2020 16:25:49 +0300 Subject: [PATCH] Fix notes --- README.md | 24 +++++++++++++----------- local-block_dm-era.sh => zz_dm-era.sh | 6 ++++-- 2 files changed, 17 insertions(+), 13 deletions(-) rename local-block_dm-era.sh => zz_dm-era.sh (52%) diff --git a/README.md b/README.md index e7be367..6e177ec 100644 --- a/README.md +++ b/README.md @@ -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. 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= 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. - Use GPT and partition UUIDs to be safe because dm-era doesn't check - if you supply the correct partition to it. -4. Edit `/etc/fstab` and change your actual device to `/dev/mapper/`, + 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. +4. Add `dm_era` to `/etc/initramfs-tools/modules`. +5. Edit `/etc/fstab` and change your actual device to `/dev/mapper/`, for example `/dev/mapper/root_era`. -5. Repeat it for more partitions if you want. -6. If you do it for the root partition also change `/etc/default/grub`: +6. Repeat it for more partitions if you want. +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`. -7. Reboot. -8. 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). -10. 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 +9. Reboot. +10. Install dm-era tools (`era_invalidate`) with `apt-get install thin-provisioning-tools` on your target host. +11. Install `era_copy` and `era_apply` (`make install` from this repository) on both hosts (target host and backup host). +12. Do an initial full partition backup with block-level copy. +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 your device configuration. diff --git a/local-block_dm-era.sh b/zz_dm-era.sh similarity index 52% rename from local-block_dm-era.sh rename to zz_dm-era.sh index a468a6f..1dd79f3 100755 --- a/local-block_dm-era.sh +++ b/zz_dm-era.sh @@ -1,4 +1,5 @@ #!/bin/sh +# Put into /etc/initramfs-tools/scripts/local-block set -e @@ -18,7 +19,8 @@ esac modprobe dm-era -DATA_DEVICE=/dev/disk/by-partuuid/ca313f78-7911-994b-b465-5cda9a3ceafb -META_DEVICE=/dev/disk/by-partuuid/be47b5e2-1587-1243-9c5f-f9e165df5c30 +DATA_DEVICE=`realpath /dev/disk/by-partuuid/ca313f78-7911-994b-b465-5cda9a3ceafb` +META_DEVICE=`realpath /dev/disk/by-partuuid/be47b5e2-1587-1243-9c5f-f9e165df5c30` 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"