#779 Issue closed: Move away restored files that should not have been restored.

Labels: enhancement, fixed / solved / done

jsmeix opened issue at 2016-02-16 10:43:

After backup restore rear should move away files
that should not have been restored - maily files that
are created and maintained by system tools where
a restore from the backup results wrong/outdated
content that conflicts with the actual system.

Implementation details:

rear should not remove files (any user data is sacrosanct).
Instead rear should move those files away into a
rear-specific directory so that the admin can inspect
that directory to see what rear thinks should not have been
restored.

There should be nothing hardcoded in the scripts.
Instead there should be a documented predefined list
in default.conf what files are moved away by default.

There should be one single additional script that
implements this functionality which is added to the
"recover" workflow to be run after backup restore.

Background information:

Some files are created and maintained by system tools.

The generic traditional example of such a file was /etc/mtab.

Files that are created and maintained by system tools
must not be restored with outdated content from a backup.

But rear must assume that the backup contains all files and
that the backup restore restored all files.

Accordingly after the backup restore rear should move away files
that should not have been restored.

For background information see https://github.com/rear/rear/issues/770 in particular see https://github.com/rear/rear/issues/770#issuecomment-184191909

jsmeix commented at 2016-02-16 13:34:

In https://github.com/rear/rear/pull/780 I implemented that functionality.

I tested it on SLE12-SP1 and that functionality works for me.

But my curent default.conf setting

BACKUP_RESTORE_MOVE_AWAY_FILES=( /etc/udev/rules.d/70-persistent-net.rules )

seems to not solve https://github.com/rear/rear/issues/770 because now I do no longer have real networking after recovery - I only have the 'lo' interface but in the original system there was also 'eth0'.

jsmeix commented at 2016-02-16 13:47:

Also with empty BACKUP_RESTORE_MOVE_AWAY_FILES I do no longer have real networking after recovery so that moving /etc/udev/rules.d/70-persistent-net.rules away is not the root cause why I do no longer have real networking after recovery.

jsmeix commented at 2016-02-16 14:59:

I should have mentioned that in the rear recovery system I do have network and I can restore the backup from my NFS server.
But I do not have network after rebooting into the recovered system.

gdha commented at 2016-02-16 15:49:

Do you see any special messages via journalctl output related to a missing file? According http://www.vcritical.com/2010/10/getting-eth0-back-in-a-sles-for-vmware-clone/ we may delete the file or update it. As long that is not clear why caused your issue we better not accept the pull request.

jsmeix commented at 2016-02-16 16:38:

It seems somehow I messed up my test system because it also does no longer work with the official SLE12 rear1172a package where it had "just worked" in the past.

I will re-test tomorrow on new test systems (KVM/QEMU virtual machines).

jsmeix commented at 2016-02-17 14:51:

All clear now for me:

On new test systems both the official SLE12 rear1172a package
and the current upstream rear with my addons in https://github.com/rear/rear/pull/780 it "just works" on a SLE12-SP1 system - in particular I have network (I use DHCP):

Interestingly removing /etc/udev/rules.d/70-persistent-net.rules on my SLE12-SP1 test systems does not change anything because it will be recreated with exact same content after recovery:

# diff -wups /var/lib/rear/backup_restore_moved_away/etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules
Files /var/lib/rear/backup_restore_moved_away/etc/udev/rules.d/70-persistent-net.rules and /etc/udev/rules.d/70-persistent-net.rules are identical
# cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /usr/lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x10ec:0x8139 (8139cp)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="8139cp", ATTR{dev_id}=="0x0", KERNELS=="0000:00:03.0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

jsmeix commented at 2016-02-18 16:26:

Implemeted via https://github.com/rear/rear/pull/780

I have tested the enhanced move away functionality so that also a whole directory tee can be moved away by using in /etc/rear/local.conf

BACKUP_RESTORE_MOVE_AWAY_FILES=( /var/tmp /etc/udev/rules.d/70-persistent-net.rules )

and for me everything "just works".

jsmeix commented at 2016-02-19 11:01:

https://github.com/rear/rear/pull/784 implements more safely remove for move away functionality so that only the directory content is removed but the empty directory itself is kept (e.g. useful to remove content in /var/tmp but keep /var/tmp)

jsmeix commented at 2016-02-19 11:02:

Merged https://github.com/rear/rear/pull/784


[Export of Github issue for rear/rear.]