#1593 PR merged: Let the user enforce MIGRATION_MODE

Labels: enhancement, bug, fixed / solved / done

jsmeix opened issue at 2017-11-22 16:17:

When the user can (if needed) enforce MIGRATION_MODE
he can avoid a disastrous disaster recovery as in
https://github.com/rear/rear/issues/1271

By the way I found a bug in layout/prepare/default/300_map_disks.sh
because for same disk with same size it mapped
e.g. /dev/sda to /sys/block/sda but the latter is no
block device which lets "rear recover" BugError out with

BUG in /usr/share/rear/layout/prepare/GNU/Linux/100_include_partition_code.sh line 35:
'Disk /sys/block/sda is not a block device.'

jsmeix commented at 2017-11-22 16:18:

A quick "rear recover" test worked for me
but I need to do some more tests...

jsmeix commented at 2017-11-23 08:21:

I never liked my current hardcoded fixed 10 seconds timeout
for the UserInput but yesterday I had no better idea
but - as always - sleeping over it helped so that I got
an idea how I could properly implement it ...

jsmeix commented at 2017-11-23 14:12:

@gdha
many thanks for having a look at my code and
even more thanks for your automated testing!

Now when "Disk configuration looks identical"
there is still a UserInput() confirmation dialog
with 30 seconds timeout to be on the safe side.

To avoid that 30 seconds delays during automated testing
you can specify

# export MIGRATION_MODE='false'

directly before calling "rear recover"
(or specify that in local.conf)
or
you can specify

# export USER_INPUT_TIMEOUT=1

directly before calling "rear recover"
(or specify that in local.conf)
or
you can specify

# export USER_INPUT_DISK_LAYOUT_PROCEED_RECOVERY='y'

perhaps even together with

# export USER_INPUT_INTERRUPT_TIMEOUT=1

directly before calling "rear recover"
(or specify that in local.conf)

jsmeix commented at 2017-11-23 14:16:

@schabrolles
I would appreciate it if you could test how that behaves for you
on your systems in particular in case of multipath migration.

gdha commented at 2017-11-24 08:34:

@jsmeix I have just done a test and all works fine!!! Thanks for the excellent job

2017-11-24 08:17:28.998198443 Including layout/prepare/default/250_compare_disks.sh
2017-11-24 08:17:28.999962579 Comparing disks
2017-11-24 08:17:29.047481379 Comparing sda
2017-11-24 08:17:29.048769202 Device /sys/block/sda exists
2017-11-24 08:17:29.053505051 Device sda has size 54223962112 but 42949672960 is expected (needs manual configuration)
2017-11-24 08:17:29.063585380 Switching to manual disk layout configuration
2017-11-24 08:17:29.080640989 Including layout/prepare/default/270_overrule_migration_mode.sh
2017-11-24 08:17:29.083932834 Switching off manual disk layout configuration (MIGRATION_MODE) due to 'unattended' kernel option
2017-11-24 08:17:29.095804471 Including layout/prepare/default/300_map_disks.sh
2017-11-24 08:17:29.098846677 Including layout/prepare/default/310_remove_exclusions.sh
2017-11-24 08:17:29.101952223 Including layout/prepare/default/320_apply_mappings.sh
2017-11-24 08:17:29.104848042 Including layout/prepare/default/400_autoresize_disks.sh
2017-11-24 08:17:29.107941396 Including layout/prepare/default/500_confirm_layout_file.sh
2017-11-24 08:17:29.111443971 Including layout/prepare/default/510_list_dependencies.sh
2017-11-24 08:17:29.160749220 Including layout/prepare/default/520_exclude_components.sh
2017-11-24 08:17:29.164944951 Including layout/prepare/default/540_generate_device_code.sh
2017-11-24 08:17:29.302973327 Begin create_fs( fs:/ )
/usr/share/rear/lib/_input-output-functions.sh: line 208: type: tune4fs: not found
2017-11-24 08:17:29.308199514 Begin mount_fs( fs:/ )
2017-11-24 08:17:29.311694689 End mount_fs( fs:/ )
2017-11-24 08:17:29.312918773 End create_fs( fs:/ )
2017-11-24 08:17:29.324800552 Begin create_fs( fs:/boot )

I did not add any additional variable in the config file:

2017-11-24 09:14:52.810097582 ReaR version that will be tested is:
Warning: Permanently added '192.168.33.10' (ECDSA) to the list of known hosts.^M
Relax-and-Recover 2.2-git.0.91d671b.unknown / 2017-11-23
2017-11-24 09:14:53.059137684

2017-11-24 09:14:53.060341414 Content of /etc/rear/local.conf is:
Warning: Permanently added '192.168.33.10' (ECDSA) to the list of known hosts.^M
OUTPUT=ISO
OUTPUT_URL=nfs://10.0.2.2/export/isos

BACKUP=BAREOS
BAREOS_RESTORE_JOB=client-restore
BAREOS_FILESET=client-fileset
BAREOS_RECOVERY_MODE="automatic"

PRE_BACKUP_SCRIPT=/usr/local/bin/client-backup-with-bareos

PROGS=( "${PROGS[@]}" showmount mount.nfs umount.nfs )
MODULES=( "${MODULES[@]}" nfs )
PRE_RECOVERY_SCRIPT="systemctl start rpcbind.target"

PXE_CONFIG_URL=nfs://10.0.2.2/root/.config/VirtualBox/TFTP/pxelinux.cfg

ISO_DEFAULT="automatic"
ISO_RECOVER_MODE="unattended"

USE_STATIC_NETWORKING=y

FIRMWARE_FILES=( 'no' )

SSH_ROOT_PASSWORD="vagrant"
TEST_LOG_DIR_URL=nfs://10.0.2.2/export/rear-tests/logs/2017-11-24_09-13-05
2017-11-24 09:14:53.280638070

2017-11-24 09:14:53.281730764 Run 'rear -v mkbackup'

[Export of Github issue for rear/rear.]