#1658 Issue closed: With BACKUP_URL=file 'rear checklayout' always detects a changed layout

Labels: enhancement, fixed / solved / done, minor bug

jsmeix opened issue at 2017-12-21 14:04:

This is a follow up of
https://github.com/rear/rear/issues/1657

With
BACKUP_URL=file:///mybackup/
where /mybackup/ is on a separated disk partition
like /dev/sdb1 (the system is on /dev/sda)
"rear -v mkrescue" shows (excerpt)

Creating disk layout
Excluding component fs:/mybackup
Using sysconfig bootloader 'grub2'
Creating root filesystem layout

But then any subsequent 'rear checklayout'
shows (excerpt)

Creating disk layout
Using sysconfig bootloader 'grub2'
Disk layout has changed.

'rear checklayout' always detects a changed layout
because in the 'rear checklayout'
/tmp/rear.XXX/tmp/checklayout.conf
the /dev/sdb stuff that belongs to the component fs:/mybackup
is not excluded:

# diff -U0 <( grep -v '^#' /tmp/rear.VgC8Y9VNwLiBjcf/tmp/checklayout.conf | sort ) <( grep -v '^#' var/lib/rear/layout/disklayout.conf | sort )       
--- /dev/fd/63  2017-12-21 14:57:19.196961679 +0100
+++ /dev/fd/62  2017-12-21 14:57:19.196961679 +0100
@@ -50 +49,0 @@
-disk /dev/sdb 8589934592 msdos
@@ -52 +50,0 @@
-fs /dev/sdb1 /mybackup xfs uuid=8f5e34d8-a262-47fb-807d-ff24616fd5eb label=  options=rw,relatime,attr2,inode64,noquota
@@ -55 +52,0 @@
-part /dev/sdb 8588886016 1048576 primary none /dev/sdb1

The "Excluding component" happens in
usr/share/rear/layout/save/default/310_include_exclude.sh
which is run both for "rear mkrescue" and "rear checklayout"
so that the root cause seems to be that in case of
"rear checklayout" the EXCLUDE_COMPONENTS
or EXCLUDE_RECREATE arrays do not contain the
same entries as for "rear mkrescue".

jsmeix commented at 2017-12-21 14:21:

The easy workaround for now is to manually specify the
right EXCLUDE_COMPONENTS.

E.g. I use

BACKUP_URL=file:///mybackup/
EXCLUDE_COMPONENTS=( "${EXCLUDE_COMPONENTS[@]}" 'fs:/mybackup' )

and then "rear -v checklayout" shows
Disk layout is identical

jsmeix commented at 2018-01-05 15:29:

Found the actual difference:

# usr/sbin/rear -s mkrescue | grep _exclude
Source prep/NETFS/default/400_automatic_exclude_recreate.sh
Source layout/save/default/310_include_exclude.sh
Source layout/save/default/335_remove_excluded_multipath_vgs.sh

# usr/sbin/rear -s checklayout | grep _exclude
Source layout/save/default/310_include_exclude.sh
Source layout/save/default/335_remove_excluded_multipath_vgs.sh

i.e. prep/NETFS/default/400_automatic_exclude_recreate.sh
is not run for "rear checklayout"
and during "rear mkrescue" 400_automatic_exclude_recreate.sh does

+ source /root/rear.master/usr/share/rear/prep/NETFS/default/400_automatic_exclude_recreate.sh
...
++ EXCLUDE_RECREATE=("${EXCLUDE_RECREATE[@]}" "fs:$backup_directory_mountpoint")

...

+ source /root/rear.master/usr/share/rear/layout/save/default/310_include_exclude.sh
...
++ for component in '"${EXCLUDE_RECREATE[@]}"'
++ LogPrint 'Excluding component fs:/mybackup'

[Export of Github issue for rear/rear.]