Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"rear mkrescue" destroys existing backup on multiple ISOs #1545

Closed
jsmeix opened this issue Oct 25, 2017 · 5 comments
Closed

"rear mkrescue" destroys existing backup on multiple ISOs #1545

jsmeix opened this issue Oct 25, 2017 · 5 comments

Comments

@jsmeix
Copy link
Member

jsmeix commented Oct 25, 2017

Current ReaR master code:

Summary:
When I do a backup on multiple ISOs via "rear mkbackup"
then recovery via "rear recover" works.
But when I do after the "rear mkbackup" a "rear mkrescue"
then a recovery via "rear recover works" fails with

RESCUE e205:~ # rear -d -D recover
...
ERROR: Backup archive 'backup.tar.gz' not found.
Aborting due to an error, check /var/log/rear/rear-e205.log for details

I assume the reason is that in the first ISO
that is named "rear-HOSTNAME.iso"
there is in case of "rear mkbackup" both
the (bootable) ReaR recovery system
plus the first part of the splitted backup.

But a subsequent "rear mkrescue" overwrites that first ISO
with one that contains only the new recovery system but
no longer the first part of the splitted backup which leads
to "Backup archive 'backup.tar.gz' not found."

I do backup on multiple ISOs via this initial /etc/rear/local.conf

OUTPUT=ISO
OUTPUT_URL=nfs://10.160.4.244/nfs
BACKUP=NETFS
BACKUP_OPTIONS="nfsvers=3,nolock"
BACKUP_URL="iso:///mybackup"
ISO_MAX_SIZE=500
@jsmeix jsmeix added this to the ReaR v2.3 milestone Oct 25, 2017
@jsmeix jsmeix self-assigned this Oct 25, 2017
@jsmeix
Copy link
Member Author

jsmeix commented Oct 25, 2017

Proof:

On the original system

e205:~/rear.master # usr/sbin/rear -d -D mkbackup
Relax-and-Recover 2.2 / Git
Using log file: /root/rear.master/var/log/rear/rear-e205.log
Using backup archive '/tmp/rear.m7Og1d7PvtwpRSf/tmp/isofs/mybackup/backup.tar.gz'
Creating disk layout
Using sysconfig bootloader 'grub2'
Creating root filesystem layout
Saving file capabilities (NETFS_RESTORE_CAPABILITIES)
Copying logfile /root/rear.master/var/log/rear/rear-e205.log into initramfs as '/tmp/rear-e205-partial-2017-10-25T15:32:07+02:00.log'
Copying files and directories
Copying binaries and libraries
Copying all kernel modules in /lib/modules/4.4.21-69-default (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (169699891 bytes) in 21 seconds
Creating tar archive '/tmp/rear.m7Og1d7PvtwpRSf/tmp/isofs/mybackup/backup.tar.gz'
Preparing archive operation
Archived 24 MiB [avg 6168 KiB/sec] 
Archived 50 MiB [avg 7417 KiB/sec] 
...
Archived 1184 MiB [avg 8921 KiB/sec] 
OK
Archived 1184 MiB in 139 seconds [avg 8729 KiB/sec]
Preparing 4 ISO images
Initial (bootable) ISO image will be rear-e205.iso labelled RELAXRECOVER containing backup.tar.gz.00 (333447168 bytes)
Making additional ISO image: rear-e205_01.iso labelled RELAXRECOVER_01 containing backup.tar.gz.01 (333447168 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_01.iso (319M)
Making additional ISO image: rear-e205_02.iso labelled RELAXRECOVER_02 containing backup.tar.gz.02 (333447168 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_02.iso (319M)
Making additional ISO image: rear-e205_03.iso labelled RELAXRECOVER_03 containing backup.tar.gz.03 (255732110 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_03.iso (245M)
Making ISO image
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205.iso (498M)
Copying resulting files to nfs location
Saving /root/rear.master/var/log/rear/rear-e205.log as rear-e205.log to nfs location

results on the NFS server

nfs/e205 # ls -ltr
total 1416164
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 15:35 rear-e205_01.iso
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 15:35 rear-e205_02.iso
-rw-rw-rw- 1 nobody nogroup 256108544 Oct 25 15:35 rear-e205_03.iso
-rw-rw-rw- 1 nobody nogroup 521799680 Oct 25 15:35 rear-e205.iso
-rw-rw-rw- 1 nobody nogroup       261 Oct 25 15:35 VERSION
-rw-rw-rw- 1 nobody nogroup       202 Oct 25 15:35 README
-rw-rw-rw- 1 nobody nogroup   4568264 Oct 25 15:35 rear-e205.log

nfs/e205 # for iso in rear-e205.iso rear-e205_01.iso rear-e205_02.iso rear-e205_03.iso ; do echo $iso ; mount $iso /tmp/isomp/ 2>/dev/null ; find /tmp/isomp/ ; umount /tmp/isomp/ ; echo ==================== ; done

rear-e205.iso
/tmp/isomp/
/tmp/isomp/isolinux
/tmp/isomp/isolinux/boot.cat
/tmp/isomp/isolinux/chain.c32
/tmp/isomp/isolinux/hdt.c32
/tmp/isomp/isolinux/initrd.cgz
/tmp/isomp/isolinux/isolinux.bin
/tmp/isomp/isolinux/isolinux.cfg
/tmp/isomp/isolinux/kernel
/tmp/isomp/isolinux/menu.c32
/tmp/isomp/isolinux/message
/tmp/isomp/isolinux/pci.ids
/tmp/isomp/isolinux/poweroff.com
/tmp/isomp/isolinux/rear.help
/tmp/isomp/isolinux/reboot.c32
/tmp/isomp/isolinux/vesamenu.c32
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.log
/tmp/isomp/mybackup/backup.splitted
/tmp/isomp/mybackup/backup.tar.gz.00
====================
rear-e205_01.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.01
====================
rear-e205_02.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.02
====================
rear-e205_03.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.03
====================

Then on the original system

e205:~/rear.master # usr/sbin/rear -d -D mkrescue
Relax-and-Recover 2.2 / Git
Using log file: /root/rear.master/var/log/rear/rear-e205.log
Using backup archive '/tmp/rear.rITEfXGRMNZacS3/tmp/isofs/mybackup/backup.tar.gz'
Creating disk layout
Using sysconfig bootloader 'grub2'
Creating root filesystem layout
Saving file capabilities (NETFS_RESTORE_CAPABILITIES)
Copying logfile /root/rear.master/var/log/rear/rear-e205.log into initramfs as '/tmp/rear-e205-partial-2017-10-25T15:40:00+02:00.log'
Copying files and directories
Copying binaries and libraries
Copying all kernel modules in /lib/modules/4.4.21-69-default (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (169693456 bytes) in 20 seconds
Making ISO image
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205.iso (170M)
Copying resulting files to nfs location
Saving /root/rear.master/var/log/rear/rear-e205.log as rear-e205.log to nfs location

results on the NFS server

nfs/e205 # ls -ltr
total 1079708
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 15:35 rear-e205_01.iso
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 15:35 rear-e205_02.iso
-rw-rw-rw- 1 nobody nogroup 256108544 Oct 25 15:35 rear-e205_03.iso
-rw-rw-rw- 1 nobody nogroup 177375232 Oct 25 15:40 rear-e205.iso
-rw-rw-rw- 1 nobody nogroup       261 Oct 25 15:40 VERSION
-rw-rw-rw- 1 nobody nogroup       202 Oct 25 15:40 README
-rw-rw-rw- 1 nobody nogroup   4467922 Oct 25 15:40 rear-e205.log

nfs/e205 # for iso in rear-e205.iso rear-e205_01.iso rear-e205_02.iso rear-e205_03.iso ; do echo $iso ; mount $iso /tmp/isomp/ 2>/dev/null ; find /tmp/isomp/ ; umount /tmp/isomp/ ; echo ==================== ; done

rear-e205.iso
/tmp/isomp/
/tmp/isomp/isolinux
/tmp/isomp/isolinux/boot.cat
/tmp/isomp/isolinux/chain.c32
/tmp/isomp/isolinux/hdt.c32
/tmp/isomp/isolinux/initrd.cgz
/tmp/isomp/isolinux/isolinux.bin
/tmp/isomp/isolinux/isolinux.cfg
/tmp/isomp/isolinux/kernel
/tmp/isomp/isolinux/menu.c32
/tmp/isomp/isolinux/message
/tmp/isomp/isolinux/pci.ids
/tmp/isomp/isolinux/poweroff.com
/tmp/isomp/isolinux/rear.help
/tmp/isomp/isolinux/reboot.c32
/tmp/isomp/isolinux/vesamenu.c32
====================
rear-e205_01.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.01
====================
rear-e205_02.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.02
====================
rear-e205_03.iso
/tmp/isomp/
/tmp/isomp/mybackup
/tmp/isomp/mybackup/backup.tar.gz.03
====================

so that the files

mybackup/backup.log
mybackup/backup.splitted
mybackup/backup.tar.gz.00

are missing after "rear mkrescue" in the
first ISO that is named "rear-HOSTNAME.iso"

@jsmeix
Copy link
Member Author

jsmeix commented Oct 25, 2017

As a quick fix at least for now I aviod this issue via
63cc512
by forbidding the mkrescue workflow if ISO_MAX_SIZE is set
which is a part of #1542

Perhaps not the very best solution but I guess nowadays
ISO_MAX_SIZE is amlost nowhere used in practice
so that I won't spend much time on such issues.

FYI
how it now works for me:

e205:~/rear.master # usr/sbin/rear -d -D mkbackup
Relax-and-Recover 2.2 / Git
Using log file: /root/rear.master/var/log/rear/rear-e205.log
Using backup archive '/tmp/rear.sEE15B8AE6KapJH/tmp/isofs/mybackup/backup.tar.gz'
Creating disk layout
Using sysconfig bootloader 'grub2'
Creating root filesystem layout
Saving file capabilities (NETFS_RESTORE_CAPABILITIES)
Copying logfile /root/rear.master/var/log/rear/rear-e205.log into initramfs as '/tmp/rear-e205-partial-2017-10-25T16:21:36+02:00.log'
Copying files and directories
Copying binaries and libraries
Copying all kernel modules in /lib/modules/4.4.21-69-default (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (169704648 bytes) in 20 seconds
Creating tar archive '/tmp/rear.sEE15B8AE6KapJH/tmp/isofs/mybackup/backup.tar.gz'
Preparing archive operation
Archived 25 MiB [avg 6648 KiB/sec] 
Archived 52 MiB [avg 7659 KiB/sec] 
...
Archived 1179 MiB [avg 8818 KiB/sec] 
OK
Archived 1179 MiB in 140 seconds [avg 8629 KiB/sec]
Preparing 4 ISO images
Initial (bootable) ISO image will be rear-e205.iso labelled RELAXRECOVER containing backup.tar.gz.00 (333447168 bytes)
Making additional ISO image: rear-e205_01.iso labelled RELAXRECOVER_01 containing backup.tar.gz.01 (333447168 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_01.iso (319M)
Making additional ISO image: rear-e205_02.iso labelled RELAXRECOVER_02 containing backup.tar.gz.02 (333447168 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_02.iso (319M)
Making additional ISO image: rear-e205_03.iso labelled RELAXRECOVER_03 containing backup.tar.gz.03 (255717430 bytes)
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205_03.iso (245M)
Making ISO image
Wrote ISO image: /root/rear.master/var/lib/rear/output/rear-e205.iso (498M)
Copying resulting files to nfs location
Saving /root/rear.master/var/log/rear/rear-e205.log as rear-e205.log to nfs location

that results on the NFS server

nfs/e205 # ls -ltr
total 1416156
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 16:24 rear-e205_01.iso
-rw-rw-rw- 1 nobody nogroup 333821952 Oct 25 16:24 rear-e205_02.iso
-rw-rw-rw- 1 nobody nogroup 256094208 Oct 25 16:24 rear-e205_03.iso
-rw-rw-rw- 1 nobody nogroup 521803776 Oct 25 16:24 rear-e205.iso
-rw-rw-rw- 1 nobody nogroup       261 Oct 25 16:24 VERSION
-rw-rw-rw- 1 nobody nogroup       202 Oct 25 16:24 README
-rw-rw-rw- 1 nobody nogroup   4568156 Oct 25 16:24 rear-e205.log

and a subsequent

e205:~/rear.master # usr/sbin/rear -d -D mkrescue
Relax-and-Recover 2.2 / Git
Using log file: /root/rear.master/var/log/rear/rear-e205.log
Using backup archive '/tmp/rear.JTxu3cWaTSOJry2/tmp/isofs/mybackup/backup.tar.gz'
Creating disk layout
Using sysconfig bootloader 'grub2'
Creating root filesystem layout
Saving file capabilities (NETFS_RESTORE_CAPABILITIES)
Copying logfile /root/rear.master/var/log/rear/rear-e205.log into initramfs as '/tmp/rear-e205-partial-2017-10-25T16:26:38+02:00.log'
Copying files and directories
Copying binaries and libraries
Copying all kernel modules in /lib/modules/4.4.21-69-default (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (169702405 bytes) in 20 seconds
ERROR: The mkrescue workflow is forbidden when ISO_MAX_SIZE is set
Aborting due to an error, check /root/rear.master/var/log/rear/rear-e205.log for details

results no change of the existing files on the NFS server
so that then "rear recover" still "just works".

jsmeix added a commit that referenced this issue Oct 25, 2017
…_is_related_to_issue_1541

Forbidd the mkrescue workflow if ISO_MAX_SIZE is set
to aviod that "rear mkrescue" destroys an existing backup
on multiple ISOs an better explain ISO_MAX_SIZE in default.conf
cf. #1545
plus
replace "var=$( ls globbing_pattern )" by "echo -n globbing_pattern"
where possible to be fail-safe for 'shopt -s nullglob'
cf. #1542 (comment)
plus
explicitly "return 0" when return is intended after a failed command
as in "test CONDITION || return 0"
cf. #1542 (comment)
@jsmeix
Copy link
Member Author

jsmeix commented Oct 25, 2017

I consider it sufficiently fixed via
63cc512
in #1542

@jsmeix jsmeix closed this as completed Oct 25, 2017
jsmeix added a commit that referenced this issue Oct 26, 2017
…_for_iso_backup_scheme_issues_1547_and1548

Forbid mkrescue and mkbackuponly for BACKUP_URL="iso:///..."
because they do not make sense when the backup
is configured to be in the ISO,
see #1545
and #1547
and #1548
Require BACKUP_URL for BACKUP=NETFS and
document that in default.conf and in the man page
see #1532 (comment)
and subsequent comments.
@jsmeix
Copy link
Member Author

jsmeix commented Oct 26, 2017

With #1549 merged
this issue should now be completely fixed.

@jsmeix
Copy link
Member Author

jsmeix commented Oct 26, 2017

FYI why I consider this one as a "critical" bug:

Because without internal knowledge how multiple ISOs
are implemented a user could assume that after an
initial "rear mkbackup" he could use "rear mkrescue"
to re-create the rescue system on the first ISO
and keep the backup on the other ISOs intact.

I.e. a user could falsely asume the first ISO
that is named "rear-HOSTNAME.iso"
(same name as a usual rescue system ISO)
contains only the rescue system and
the other ISOs that are named
rear-HOSTNAME_01.iso rear-HOSTNAME_02.iso ...
contain the splitted backup.tar.gz file
so that he could safely run "rear mkrescue"
to update the "rear-HOSTNAME.iso"
but actually that is not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant