#1847 Issue closed: Files (also restored files) get needlessly modified for identical mapping /dev/sda => /dev/sda

Labels: enhancement, cleanup, fixed / solved / done

jsmeix opened issue at 2018-06-29 14:46:

Using current master code.

When there are two disks /dev/sda and /dev/sdb with same size
"rear recover" goes into MIGRATION_MODE
(which is right to be on the safe side):

Comparing disks
Ambiguous possible target disks need manual configuration (more than one with same size found)
Switching to manual disk layout configuration
Using /dev/sda (same name and same size) for recreating /dev/sda
Current disk mapping table (source -> target):
    /dev/sda /dev/sda

But when that identical mapping "/dev/sda => /dev/sda" is used
then files like disklayout.conf and during finalize stage even restored files
get needlessly modified (hopefully usually with actually identical modification
but that lots of needlessly done sed magic might result unwanted changes):

Applying disk layout mappings in /var/lib/rear/layout/disk_mappings to certain restored files...
The original restored files get saved in var/lib/rear/saved_original_files/ (in /mnt/local)
Applied disk layout mappings to restored 'boot/grub2/grub.cfg' (in /mnt/local)
Applied disk layout mappings to restored 'boot/grub2/device.map' (in /mnt/local)
Applied disk layout mappings to restored 'etc/sysconfig/bootloader' (in /mnt/local)
Applied disk layout mappings to restored 'etc/fstab' (in /mnt/local)
Applied disk layout mappings to restored 'etc/mtools.conf' (in /mnt/local)
Applied disk layout mappings to restored 'etc/smartd.conf' (in /mnt/local)
Applied disk layout mappings to restored 'etc/sysconfig/smartmontools' (in /mnt/local)

One can see that since https://github.com/rear/rear/pull/1843 is merged
but it happened all the time (only silently and without saving original files).

I will try to detect a completely identical mapping
i.e. all entries in /var/lib/rear/layout/disk_mappings must be an identity map like

/dev/sda /dev/sda
/dev/sdb /dev/sdb
/dev/sdc /dev/sdc

and in this case all what belongs to /var/lib/rear/layout/disk_mappings
can be skipped.

jsmeix commented at 2018-07-02 14:40:

In https://github.com/rear/rear/pull/1848 the commit
https://github.com/rear/rear/pull/1848/commits/f23c601857a9b8e6cb08892b1e3b67257ad5314a
is intended to fix this issue here, see
https://github.com/rear/rear/pull/1848#issuecomment-401828054

jsmeix commented at 2018-07-16 11:44:

With https://github.com/rear/rear/pull/1848 merged
this issue should be fixed.


[Export of Github issue for rear/rear.]