[Borgbackup] How to fix corrupted index or hints?

Sebastian Felis sebastian at silef.de
Thu Nov 17 17:04:36 EST 2022


On 11/17/22 21:51, Thomas Waldmann wrote:
>> I will rerun the check and will provide the full log.
>
> "borg check -v REPO" please, so it runs repository AND archives checks.
>
> But first check your rsync command, see below.


I am running now: borg check --verify-data --repair --debug --progress 
--show-version --show-rc


>> Could that be produced by a merge of an backup repo to the original 
>> one? At the end I did an rsync -a from the backup to the original 
>> repo so the state should be the state of the backup + newer files of 
>> the original repo.
>
> Uhoh, you can not do it like that and mix ("merge") stuff together.
>
> If you want to rsync a valid repo from location SRC to location DST, 
> you need something like:
>
> rsync -a --delete SRC/ DST/
>
> The --delete is important to delete files in DST that are not any more 
> in SRC, otherwise you might get a weird mix up.
>
> Did you forget the --delete?


No. It was on purpose not to run --delete. I have a broken btrfs 
partition and tried to recover it with the help of the backup. My 
thought was more a merge of btrfs recovery and rsync from the backup repo.

And if borg reports that all segments are valid what corrupts the 
segment reference count? My assumption is that borg will find and repair 
the history with a last succeeding commit. Eg. borg backup has segment 
10480, the original repo 11050 than borg could find the last commit in 
segment 11047. Is my assumption valid?


The next borg recovery check will be with preceding rsync with --delete. 
Thank you for the hint.

>>>> I tried to remove the hints file on the repo side, deleted the 
>>>> client cache via "borg delete --cache-only" and run "borg check 
>>>> --debug --progress --repair":
>
> I just checked in the code: borg check --repair rebuilds the hints and 
> index from information found in the segment files only.


So it should be fine to delete hints and index files on the repo and 
call borg check --repair. Than the "usage count" and "freeable space" 
should be fine?


Have a good evening

Sebastian



More information about the Borgbackup mailing list