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

Check for empty NETFS 'tar' backup #3217

Closed
jsmeix opened this issue May 3, 2024 · 1 comment
Closed

Check for empty NETFS 'tar' backup #3217

jsmeix opened this issue May 3, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@jsmeix
Copy link
Member

jsmeix commented May 3, 2024

Currently there is no check if a NETFS 'tar' backup is empty.

What gets included in a NETFS 'tar' backup
gets specified in $TMP_DIR/backup-include.txt by
backup/NETFS/default/400_create_include_exclude_files.sh
via var/lib/rear/recovery/mountpoint_device that was made by
layout/save/default/340_generate_mountpoint_device.sh
based on the active 'fs' entries disklayout.conf

In certain cases it can happen that backup-include.txt
does not contain '/' or is even empty, e.g. see
starting at
#3189 (comment)
and the subsequent comments therein down to
#3189 (comment)

So I am thinking about a generic check for an empty NETFS backup
(regardless of multipath or whatever).

My point is that I assume at least '/' must be included
in any backup because it is the basic functionality
that "rear mkbackup" makes a backup of the files
of the basic system so at least '/' must be
backed up (with '--one-file-system').

So in case of a NETFS backup at least '/'
should normally be in backup-include.txt
and - as far as I can imagine - at least an
empty backup-include.txt is always an error.

Cf.
#3189 (comment)

By the way:
It seems '/' is last in backup-include.txt
see
#3189 (comment)
(excerpt):

2024-04-29 14:45:49.347139698 Backup include list (backup-include.txt contents):
2024-04-29 14:45:49.349245934   /boot/grub2/i386-pc
2024-04-29 14:45:49.351251309   /boot/grub2/x86_64-efi
2024-04-29 14:45:49.353379145   /home
2024-04-29 14:45:49.355323537   /opt
2024-04-29 14:45:49.357239244   /root
2024-04-29 14:45:49.359060043   /srv
2024-04-29 14:45:49.360984958   /tmp
2024-04-29 14:45:49.362798965   /usr/local
2024-04-29 14:45:49.364743496   /var
2024-04-29 14:45:49.366581308   /

But I think it would be better in general to have '/'
first in backup-include.txt to get the files and directories
of the the basic system first stored in backup.tar.gz
so that in particular the directories of the the basic system
get restored first during "rear recover" so that those
directories are already there when later other files
get restored into the basic system directories.
Perhaps the ordering may not actually matter but at least
it looks "unexpected" to store and restore '/' last, cf.
#3177 (comment)

@jsmeix jsmeix added enhancement Adaptions and new features cleanup labels May 3, 2024
@jsmeix jsmeix added this to the ReaR v2.8 milestone May 3, 2024
@jsmeix jsmeix self-assigned this May 3, 2024
jsmeix added a commit that referenced this issue May 14, 2024
Overhauled 400_create_include_exclude_files.sh

Now do first backup the mounted filesystems
to backup '/' first so the basic system files get stored
first in the backup and then backup what is specified in BACKUP_PROG_INCLUDE
see #3177 (comment)
and #3217 (comment)

Report suspicious cases as LogPrintError to have the user at least informed.

Remove duplicates but keep the ordering.
to avoid possibly unwanted and unexpected subtle consequences
see #3175 (comment)

Verify that at least '/' is in backup-include.txt
see #3217

Redirect stdout into files exactly at the command where needed
instead of more global redirections,
cf. "horrible coding style"
in #3175 (comment)
jsmeix added a commit that referenced this issue May 15, 2024
Overhauled backup/NETFS/default/400_create_include_exclude_files.sh
* Now do first backup the mounted filesystems to backup '/' first
so the basic system files get stored first in the backup and
then backup what is specified in BACKUP_PROG_INCLUDE
see #3177 (comment)
and #3217 (comment)
* Report suspicious cases as LogPrintError to have the user at least informed.
* Remove duplicates in backup-[in/ex]clude.txt but keep the ordering
to avoid possibly unwanted and unexpected subtle consequences
see #3175 (comment)
* Verify that at least '/' is in backup-include.txt
see #3217
* Redirect stdout into files exactly at the command where needed
instead of more global redirections, cf. "horrible coding style"
in #3175 (comment)

Update backup/NETFS/default/500_make_backup.sh
* In backup/NETFS/default/500_make_backup.sh
unique_unsorted is no longer needed because
backup-include.txt is already without duplicates
because unique_unsorted is now called in
backup/NETFS/default/400_create_include_exclude_files.sh
@jsmeix
Copy link
Member Author

jsmeix commented May 15, 2024

With #3221 merged
this issue should be fixed.

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

No branches or pull requests

1 participant