Re: How to restore, overwriting existing files but not removing other files
Exuvo <[email protected]> Sat, 20 Jan 2024 14:07:30 +0100
| Newsgroups | gmane.comp.sysutils.backup.rdiff-backup.general |
|---|---|
| Message-ID | <[email protected]> |
Okay thanks but that still feels a bit error prone just knowing --force has a tendency to delete unrelated files.
I'd really like some kind of half --force ex --replace-only, that never deletes things but does replace existing file that are different from the backup.
I think i will just restore to a new directory and then manually copy them over to be sure nothing else gets deleted.
Or maybe not attempt recoveries late at night.
Anton "exuvo" Olsson
[email protected]
On 2024-01-20 13:59, Eric Lavarde wrote:
> Hi,
>
> On 19.01.2024 03:22, Exuvo wrote:
>> Some of my files got corrupted in /destination ex /destionation/a and
>> /destionation/b.
>> I have rdiff-backups of a few of the directories in /destination but
>> not all via --exclude lines ex /destionation/c.
>> Restoring with "rdiff-backup restore backupDir /destination" says
>> ERROR target path /destination exists and isnt empty, call with
>> --force to overwrite.
>> So i tried with force but that then starts deleting everything that
>> was excluded instead of just overwriting conflicts.
>> How do i get it to restore the backup but not deleting everything that
>> was not in the backup?
>>
>> I still have my tape backups of everything rdiff-deleted so nothing is
>> lost but that is going to take two days to restore.
>
> There are multiple ways to do it, here as examples:
>
> mkdir /tmp/from
> for x in a b c; do echo original > /tmp/from/$x; done
> rdiff-backup backup /tmp/from /tmp/bak
> for x in a b c; do echo modified > /tmp/from/$x; done
> # if you have few files to exclude (multiple excludes are possible)
> rdiff-backup --force restore --exclude /tmp/from/c /tmp/bak /tmp/from
> # if you have few files to include (multiple includes are possible)
> rdiff-backup --force restoreĀ --include /tmp/from/a --exclude \** /tmp/bak /tmp/from
> # if you have only one file to restore
> rdiff-backup --force restore /tmp/bak/a /tmp/from/a
>
> So, basically, as you restore, excluded files are being simply ignored and left alone.
>
> Hope this helps,
> Eric