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

Support BACKUP_TYPE=incremental/differential also for BACKUP_URL=usb: #1145

Closed
jsmeix opened this issue Jan 2, 2017 · 11 comments
Closed

Support BACKUP_TYPE=incremental/differential also for BACKUP_URL=usb: #1145

jsmeix opened this issue Jan 2, 2017 · 11 comments
Assignees
Labels
enhancement Adaptions and new features fixed / solved / done
Milestone

Comments

@jsmeix
Copy link
Member

jsmeix commented Jan 2, 2017

Neither BACKUP_TYPE 'incremental' nor 'differential'
works with BACKUP_URL=usb:///...
see
#1141 (comment)

Up to ReaR 2.0
BACKUP_URL=usb:///... only works
with 'nomal' BACKUP_TYPE="".

@jsmeix jsmeix added the enhancement Adaptions and new features label Jan 2, 2017
@jsmeix jsmeix added this to the Rear future milestone Jan 2, 2017
@jsmeix jsmeix self-assigned this Jan 2, 2017
@gdha
Copy link
Member

gdha commented Jan 2, 2017

@jsmeix By now you know my point of view - do not make of ReaR a backup tool which must support incremental backup. And, as USB work-flow use timestamp directories it would be hard to implement.

@jsmeix
Copy link
Member Author

jsmeix commented Jan 2, 2017

I completely agree with your point of view.

I only thought that when ReaR has support for
incremental/differential backup, then it should
work as far as possible with reasonable effort.

Personally I would prefer ReaR has only basic
backup support by its internal backup methods
and leave all advanced backup functionality
to external backup solutions.

If my #1146
is o.k. for you we can leave it at this state
also for future ReaR versions.

@jsmeix jsmeix added the needs sponsorship This issue will not get solved on a voluntary base by ReaR upstream. label Jan 2, 2017
jsmeix added a commit that referenced this issue Jan 3, 2017
…_TYPE_incremental_or_differential_issue1141_and_issue1145

Forbid BACKUP_URL=usb for
BACKUP_TYPE=incremental/differential.
Incremental or differential backup is currently
only known to work with BACKUP_URL=nfs.
Other BACKUP_URL schemes may work
but at least BACKUP_URL=usb is known
not to work with incremental or differential
backup, see
#1141
and
#1145
@jsmeix jsmeix modified the milestones: Rear v2.1, Rear future Jan 9, 2017
@jsmeix
Copy link
Member Author

jsmeix commented Jan 9, 2017

Perhaps it is possible with low effort to make
BACKUP_TYPE=incremental/differential
also work for BACKUP_URL=usb:

My (currently totally untested) basic idea behind is
that the timestamp directories that are used for
BACKUP_URL=usb implement basically the same
behaviour as NETFS_KEEP_OLD_BACKUP_COPY
so that perhaps it is possible with low effort to use a
single static directory also for BACKUP_URL=usb
in case of BACKUP_TYPE=incremental/differential.

See conf/default.conf why there is no need for NETFS_KEEP_OLD_BACKUP_COPY
together with incremental or differential backup
so that I guess there is perhaps also no need for
timestamp directories for BACKUP_URL=usb
together with incremental or differential backup.

FYI:
Personally I am not so happy that ReaR supports advanced
backup features like BACKUP_TYPE=incremental/differential
but as it is already there I like to get it working well as far as
possible with reasonable effort.

@jsmeix
Copy link
Member Author

jsmeix commented Jan 12, 2017

As expected as side-effect of implementing
#1160
I made BACKUP_TYPE=incremental/differential
also work for BACKUP_URL=usb
with the following code hack in addition to the
hacks that I described in
#1160 (comment)

Additional code change
(I run it in a current GitHub master code clone):

# git diff usr/share/rear/prep/NETFS/default/070_set_backup_archive.sh
...
@@ -55,7 +55,7 @@
...
-    Error "BACKUP_TYPE incremental or differential does not work with BACKUP_URL=usb:///..."
+    LogPrint "Note: BACKUP_TYPE incremental or differential needs special setup for BACKUP_URL=usb:///..."
...

Used config
(no multiple backups for BACKUP_TYPE=incremental/differential)

OUTPUT=USB
USB_DEVICE=/dev/disk/by-label/REAR-000
USB_PREFIX="rear/$HOSTNAME/incrementalbackups"
USB_RETAIN_BACKUP_NR=999
BACKUP=NETFS
BACKUP_URL=usb:///dev/disk/by-label/REAR-000
BACKUP_TYPE=incremental
FULLBACKUP_OUTDATED_DAYS=7
FULLBACKUPDAY=Thu

First I run "usr/sbin/rear -d -D mkbackup"
to get an initial full backup of today.

Afterwards I change the config to

FULLBACKUPDAY=Wed

to get incremental backups.

I made two subsequent incremental backups
(I run it in a current GitHub master code clone):

# echo testy1 >/testy1

# usr/sbin/rear -d -D mkbackup

# echo testy2 >/testy2

# usr/sbin/rear -d -D mkbackup

On the REAR-000 medium I get (excerpt)

rear/e205/incrementalbackups
rear/e205/incrementalbackups/kernel
rear/e205/incrementalbackups/rear-e205.log
rear/e205/incrementalbackups/initrd.cgz
rear/e205/incrementalbackups/2017-01-12-1105-F.tar.gz
rear/e205/incrementalbackups/syslinux.cfg
rear/e205/incrementalbackups/2017-01-12-1115-I.tar.gz
rear/e205/incrementalbackups/backup.log
rear/e205/incrementalbackups/2017-01-12-1114-I.tar.gz

and for me "rear recover" works well with that.

@dwerner1
please test how far my above described changes also make
it work for your particular use case and provide feedback here
what goes wrong and/or what is missing for your use case.

@dwerner1
Copy link

When doing rear -d -D mkbackup with local.conf like

BACKUP=NETFS
OUTPUT=USB
USB_DEVICE=/dev/disk/by-label/REAR-000
USB_PREFIX="rear/$HOSTNAME/fixedbackupdir"
USB_RETAIN_BACKUP_NR=999
USB_DEVICE_PARTED_LABEL=gpt
USB_DEVICE_FILESYSTEM_PERCENTAGE=5
BACKUP_URL=usb:///dev/disk/by-label/REAR-DATA
BACKUP_PROG_EXCLUDE=( ${BACKUP_PROG_EXCLUDE[@]} '/tmp/*' '/temp' '/dev/shm/*' '/mnt/*' )
BACKUP_TYPE=incremental
FULLBACKUP_OUTDATED_DAYS=7
FULLBACKUPDAY=Thu

.. I end up with

ERROR: BACKUP_TYPE incremental or differential does not work with BACKUP_URL=usb:///...

Here are some lines from the log file

++ test incremental = incremental -o differential = incremental
++ set -e -u -o pipefail
++ test NETFS = NETFS -a tar = tar
++ test usb = usb
++ Error 'BACKUP_TYPE incremental or differential does not work with BACKUP_URL=usb:///...'
++ VERBOSE=1
++ LogPrint 'ERROR: BACKUP_TYPE incremental or differential does not work with BACKUP_URL=usb:///...'
++ Log 'ERROR: BACKUP_TYPE incremental or differential does not work with BACKUP_URL=usb:///...'
++ test 1 -gt 0
+++ Stamp

I'm using the current git version and the changes mentioned by @jsmeix in #1160

@jsmeix
Copy link
Member Author

jsmeix commented Jan 12, 2017

Additionally you need to use the change mentioned by me in
#1145 (comment)
;-)

@dwerner1
Copy link

Uuh, damn, sorry

@dwerner1
Copy link

OK, that worked out. I made one full and two incremental backups, just the menu labels look like you described in #1160

@dwerner1
Copy link

That's a really nice state out of my view! Many thanks @jsmeix !

@jsmeix
Copy link
Member Author

jsmeix commented Jan 12, 2017

@dwerner1
many thanks for your prompt tests even with my current hacks.

I will sleep over it so that tomorrow I have hopefully good idea
how I can implement it in a backward compatible way...

jsmeix added a commit that referenced this issue Jan 13, 2017
…on_NFS_issue1164

Align backup on USB with backup on NFS.
The new config variable USB_SUFFIX
specifies the last part of the backup directory on the USB medium.
When USB_SUFFIX is unset or empty, backup on USB works
in its current default mode (i.e. backward compatible)
which means multiple timestamp backup directories
plus automated rescue environments and backups cleanup
via USB_RETAIN_BACKUP_NR.
When USB_SUFFIX is set, backup on USB works
in compliance with how backup on NFS works
which means a fixed backup directory and
no automated removal of any stuff
(regardless of USB_RETAIN_BACKUP_NR).
When backup on USB behaves as backup on NFS
(i.e. when USB_SUFFIX is set) multiple backups and
incremental/differential backups also work on USB.
See
#1164
#1160
#1145
@jsmeix
Copy link
Member Author

jsmeix commented Jan 13, 2017

With
#1165
merged this issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adaptions and new features fixed / solved / done
Projects
None yet
Development

No branches or pull requests

3 participants