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
Local data backup with BACKUP=NETFS fails #926
Comments
Works for me f121:~/rear # grep -v '^#' etc/rear/local.conf OUTPUT=ISO BACKUP=NETFS BACKUP_URL=file:///tmp/rearbackup ... f121:~/rear # usr/sbin/rear -d -D mkbackup Relax-and-Recover 1.18 / Git Using log file: /root/rear/var/log/rear/rear-f121.log Creating disk layout Creating root filesystem layout Copying files and directories Copying binaries and libraries Copying kernel modules Creating initramfs Making ISO image Wrote ISO image: /root/rear/var/lib/rear/output/rear-f121.iso (28M) Copying resulting files to file location Encrypting disabled Creating tar archive '/tmp/rearbackup/f121/backup.tar.gz' Archived 1192 MiB [avg 10009 KiB/sec]OK Archived 1192 MiB in 123 seconds [avg 9927 KiB/sec] f121:~/rear # find /tmp/rearbackup /tmp/rearbackup /tmp/rearbackup/f121 /tmp/rearbackup/f121/rear-f121.iso /tmp/rearbackup/f121/VERSION /tmp/rearbackup/f121/README /tmp/rearbackup/f121/rear.log /tmp/rearbackup/f121/backup.tar.gz /tmp/rearbackup/f121/backup.log @tcerna You need to run it in debug mode: rear -d -D mkbackup and then inspect the rear log file what leads to that error Inspect your rear log file what happens after the line + source /root/rear/usr/share/rear/prep/NETFS/default |
Something smells here... Sometimes it also fails for me, sometimes it works for me. I tested different BACKUP_URL=file:// Below it worked with BACKUP_URL=file:///rearbackup When it works for me I have in the rear log file: + source /root/rear/usr/share/rear/prep/NETFS/default/40_automatic_exclude_recreate.sh +++ url_scheme file:///rearbackup +++ local url=file:///rearbackup +++ local scheme=file +++ echo file +++ grep -q : +++ echo file ++ local scheme=file +++ url_path file:///rearbackup +++ local url=file:///rearbackup +++ local url_without_scheme=/rearbackup +++ echo /rearbackup ++ local path=/rearbackup ++ case $scheme in +++ df -P /rearbackup +++ tail -1 +++ awk '{print $6}' ++ _mntpt= ++ [[ '' = \/ ]] I.e. when it works for me the command _mntpt=$(df -P ${path} 2>/dev/null | tail -1 | awk '{print $6}') results an empty _mntpt variable f121:~ # df -P /rearbackup Filesystem 1024-blocks Used Available Capacity Mounted on /dev/sda2 19437568 5222120 13775032 28% / f121:~ # df -P /rearbackup 2>/dev/null | tail -1 | awk '{print $6}' / Something is wrong here => somewhere there is a bug. |
@gdha Is perhaps meant that for a locally stored backup Do you perhaps even have an idea why sometimes _mntpt=$(df -P ${path} 2>/dev/null | tail -1 | awk '{print $6}') results an empty _mntpt variable? As a side note: (file) # if user added path manually then there is no need to do it again in prep/NETFS/default/40_automatic_exclude_recreate.sh |
I tried it again and I have to results: good and bad: BAD ONE:
I didn't find any strange in log file, but it does not mean that there is any strangeness. GOOD ONE:
|
When I run
Is there a problem with overwriting files ? (if yes, it could print proper message) |
I think by default "rear mkbackup" does not care about old files I think "rear mkbackup" should error out whenever there I think it must error out whenever a specified thing I assume the root cause here is that rear does not care I will do a deeper analysis what actually goes on here. I would very much appreciate any help from others with that "Given enough eyeballs, all bugs are shallow" |
One must avoid a BACKUP_URL=file:///dir For me "rear mkbackup" with BACKUP_URL=file:///rearbackup # tar -tzvf /rearbackup/f121/backup.tar.gz | grep rearbackup drwx------ root/root 0 2016-07-21 11:35 rearbackup/ drwxr-x--- root/root 0 2016-07-21 11:35 rearbackup/f121/ -rw------- root/root 0 2016-07-21 11:35 rearbackup/f121/.lockfile -rw------- root/root 120426496 2016-07-21 11:35 rearbackup/f121/rear-f121.iso -rw------- root/root 262 2016-07-21 11:35 rearbackup/f121/VERSION -rw------- root/root 202 2016-07-21 11:35 rearbackup/f121/README -rw------- root/root 6747236 2016-07-21 11:35 rearbackup/f121/rear.log -rw------- root/root 1385283584 2016-07-21 11:37 rearbackup/f121/backup.tar.gz # ls -l /rearbackup/f121/ total 2823976 -rw------- 1 root root 11080034 Jul 21 11:38 backup.log -rw------- 1 root root 2753482505 Jul 21 11:38 backup.tar.gz -rw------- 1 root root 202 Jul 21 11:35 README -rw------- 1 root root 120426496 Jul 21 11:35 rear-f121.iso -rw------- 1 root root 6747236 Jul 21 11:35 rear.log -rw------- 1 root root 262 Jul 21 11:35 VERSION Restoring that backup results a /rearbackup/$HOSTNAME I think "rear recover" that restores /rearbackup/$HOSTNAME What matters more is that having the backup in the backup # tail -n20 /rearbackup/f121/backup.log block 5531760: /root/rear/var/lib/rear/layout/lvm/ block 5531763: /root/rear/var/lib/rear/sysreqs/ block 5531766: /root/rear/var/lib/rear/sysreqs/Minimal_System_Requirements.txt block 5531771: /root/.Xauthority-n block 5531774: /root/.viminfo block 5531793: /selinux/ block 5531796: /rearbackup/ block 5531799: /rearbackup/f121/ block 5531802: /rearbackup/f121/.lockfile block 5531805: /rearbackup/f121/rear-f121.iso block 5767016: /rearbackup/f121/VERSION block 5767020: /rearbackup/f121/README block 5767024: /rearbackup/f121/rear.log block 5780206: /rearbackup/f121/backup.tar.gz tar: /rearbackup/f121/backup.tar.gz: file changed as we read it block 8485826: /root/rear/var/log/rear/rear-f121.log Total bytes written: 4344750080 (4.1GiB, 24MiB/s) 5377895+1 records in 5377895+1 records out 2753482505 bytes (2.8 GB) copied, 174.252 s, 15.8 MB/s But again a needlessly increased backup size I wonder if rear should try to be smarter than the user I think it belongs to the user to think about in advance From my current point of view I would close that issue The only bug that is see is the misleading error message ERROR: Making backup on / is forbidden. Use an external device! when one does a second "rear mkbackup" |
With BACKUP_URL=file:///rearbackup # ls -l /rearbackup/f121/backup.tar.gz -rw------- 1 root root 1266451979 Jul 21 12:20 /rearbackup/f121/backup.tar.gz # tar -tzvf /rearbackup/f121/backup.tar.gz | grep rearbackup drwxr-xr-x root/root 0 2016-07-21 12:18 rearbackup/ [no further output] # mount | grep sdb /dev/sdb1 on /rearbackup type ext2 (rw,relatime) Now even a second "rear mkbackup" works as intended # find /rearbackup /rearbackup /rearbackup/f121.old /rearbackup/f121.old/VERSION /rearbackup/f121.old/backup.tar.gz /rearbackup/f121.old/rear-f121.iso /rearbackup/f121.old/README /rearbackup/f121.old/rear.log /rearbackup/f121.old/backup.log /rearbackup/lost+found /rearbackup/f121 /rearbackup/f121/VERSION /rearbackup/f121/backup.tar.gz /rearbackup/f121/rear-f121.iso /rearbackup/f121/README /rearbackup/f121/rear.log /rearbackup/f121/backup.log # ls -l /rearbackup/*/backup.tar.gz -rw------- 1 root root 1266910902 Jul 21 12:30 /rearbackup/f121/backup.tar.gz -rw------- 1 root root 1266451979 Jul 21 12:20 /rearbackup/f121.old/backup.tar.gz |
And a third "rear mkbackup" now # ls -l /rearbackup/*/backup.tar.gz -rw------- 1 root root 1266897447 Jul 21 13:23 /rearbackup/f121/backup.tar.gz -rw------- 1 root root 1266451979 Jul 21 12:20 /rearbackup/f121.old/backup.tar.gz Conclusion from my point of view: With a proper set up everything works fine for me with The only thing left is to find out how the "_mntpt" test @gdha |
Stupid me! The "_mntpt" test # df -P qqq 2>/dev/null # df -P qqq df: 'qqq': No such file or directory and it correctly finds out that the director is mounted at '/' I will enhace the test to be more fail-safe... |
With #936 I get: With BACKUP_URL=file:///rootfsrearbackup I get ERROR: URL 'file:///rootfsrearbackup' would result the backup directory '/rootfsrearbackup' in the '/' filesystem which is forbidden. and when /rootfsrearbackup does already exist ERROR: URL 'file:///rootfsrearbackup' has the backup directory '/rootfsrearbackup' in the '/' filesystem which is forbidden. With BACKUP_URL=file:///etc/rear/local.conf I get ERROR: URL 'file:///etc/rear/local.conf' specifies '/etc/rear/local.conf' which is not a directory. With BACKUP_URL=file:///rearbackup (as above) # usr/sbin/rear -d -D mkbackup Relax-and-Recover 1.18 / Git Using log file: /root/rear/var/log/rear/rear-f121.log Creating disk layout Excluding component fs:/rearbackup ... |
But with BACKUP_URL=file:///rearbackup/subdir ERROR: URL 'file:///rearbackup/subdir' would result the backup directory '/rearbackup/subdir' in the '/' filesystem which is forbidden. I fixed handling when backup directory does not yet exist in # usr/sbin/rear -d -D mkbackup Relax-and-Recover 1.18 / Git Using log file: /root/rear/var/log/rear/rear-f121.log Creating disk layout Excluding component fs:/rearbackup ... and in rear-f121.log I get now + source /root/rear/usr/share/rear/prep/NETFS/default/40_automatic_exclude_recreate.sh +++ url_scheme file:///rearbackup/subdir +++ local url=file:///rearbackup/subdir +++ local scheme=file +++ grep -q : +++ echo file +++ echo file ++ local scheme=file +++ url_path file:///rearbackup/subdir +++ local url=file:///rearbackup/subdir +++ local url_without_scheme=/rearbackup/subdir +++ echo /rearbackup/subdir ++ local backup_directory=/rearbackup/subdir ++ local backup_directory_mountpoint= ++ case $scheme in ++ test -e /rearbackup/subdir ++ mkdir -v -p /rearbackup/subdir mkdir: created directory '/rearbackup/subdir' ++ test -d /rearbackup/subdir +++ tail -1 +++ awk '{print $6}' +++ df -P /rearbackup/subdir ++ backup_directory_mountpoint=/rearbackup ++ test / = /rearbackup ... and this is result # ls -l /rearbackup/*/*/backup.tar.gz -rw------- 1 root root 1266459574 Jul 21 15:34 /rearbackup/subdir/f121/backup.tar.gz |
…ted_more_fail_safe_issu926 make test where backup directory is mounted more fail safe see #926
Since #926 (comment) @tcerna |
Of course I also like to have it tested by |
@jsmeix thank you for your troubleshooting and fix |
No feedback from users. |
Relax-and-Recover (rear) Issue Template
Please fill in the following items before submitting a new issue:
rear-1.17.2-1.el7.noarch
RHEL-7
Brief description of the issue
When running
rear -v mkbackuponly
with BACKUP=NETFS and specified BACKUP_URL in local.conf it fails with ERROR: Making backup on / is forbidden.Actual results:
ERROR: Making backup on / is forbidden. Use an external device!
Terminated
Expected results:
Data backup is created in specified directory.
The text was updated successfully, but these errors were encountered: