borg icon indicating copy to clipboard operation
borg copied to clipboard

borg check --repair issue

Open airbillion opened this issue 9 years ago • 19 comments

When I ran a check on all the archives in my repo it found 220 orphaned items...I ran a borg check --repair and it errors out when it finishes and does not repair the archives. Is there anything I can do other than delete the whole repo and start from scratch?

Output:

230 orphaned objects found!
Remote: Borg 1.0.10: exception in RPC call:
Remote: Traceback (most recent call last):
Remote:   File "borg/remote.py", line 145, in serve
Remote:   File "borg/repository.py", line 550, in delete
Remote: borg.repository.Repository.ObjectNotFound: Object with key
b'\x10V\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' not found in repository /mnt/user/borg_backup.
Remote: 
Remote: Platform: Linux Backup 4.9.10-unRAID #1 SMP PREEMPT Wed Feb 15 09:38:14 PST 2017 x86_64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
Remote: Linux: Slackware  14.2 
Remote: Borg: 1.0.10  Python: CPython 3.5.3
Remote: PID: 22850  CWD: /root
Remote: sys.argv: ['borg', 'serve', '--umask=077', '--info']
Remote: SSH_ORIGINAL_COMMAND: None
Remote: Object with key 82 not found in repository [email protected]:/mnt/user/borg_backup/.

Traceback (most recent call last):
  File "borg/archiver.py", line 2089, in main
  File "borg/archiver.py", line 2025, in run
  File "borg/archiver.py", line 91, in wrapper
  File "borg/archiver.py", line 173, in do_check
  File "borg/archive.py", line 867, in check
  File "borg/archive.py", line 1165, in orphan_chunks_check
  File "borg/remote.py", line 462, in delete
  File "borg/remote.py", line 321, in call
  File "borg/remote.py", line 360, in call_many
  File "borg/remote.py", line 346, in handle_error
borg.repository.Repository.ObjectNotFound: Object with key 82 not found in
repository [email protected]:/mnt/user/borg_backup/.

Platform: Linux Tower 4.9.10-unRAID #1 SMP PREEMPT Wed Feb 15 09:38:14 PST 2017 x86_64 Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz
Linux: Slackware  14.2 
Borg: 1.0.10  Python: CPython 3.5.3
PID: 1073  CWD: /boot/scripts/borg_scripts
sys.argv: ['borg', 'check', '--repair', '-v', '--archives-only', '[email protected]:/mnt/user/borg_backup/']
SSH_ORIGINAL_COMMAND: None

airbillion avatar Mar 06 '17 01:03 airbillion

Hmm, can you check the logs again. It is a bit strange that server (remote) reports:

Object with key
b'\x10V\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' not found in repository /mnt/user/borg_backup.

And client (local) reports:

Object with key 82 not found in repository [email protected]:/mnt/user/borg_backup/.

The numbers do not match.

ThomasWaldmann avatar Mar 06 '17 02:03 ThomasWaldmann

Also, there is more strangeness:

Orphaned objects might be a relatively harmless error: you have repo objects that are not used (any more).

The usual fix for that (within borg check --repair) is IIRC to just delete them.

But when it tried to do that, it did not find at least one of them.

ThomasWaldmann avatar Mar 06 '17 02:03 ThomasWaldmann

So, can you check:

  • your RAID(?)
  • your fs
  • your disks (see SMART values / logs)

ThomasWaldmann avatar Mar 06 '17 02:03 ThomasWaldmann

Double checked the log... This is a direct copy paste after running the check...No luck with check --repair...I have tried with Borg versions 1.08, .09, & .10... Same error with all 3 versions. I can successfully run a check --repair on individual archives, but when it is run on all the archives in the repo the above error is thrown. Is there any way to delete just the orphaned files?

airbillion avatar Mar 06 '17 03:03 airbillion

Can you do the checks I suggested above?

ThomasWaldmann avatar Mar 06 '17 03:03 ThomasWaldmann

You are correct...orphaned chunks check is only possible when checking all archives...no error is displayed but it says there are problems found.

Would a check repository-only fix the issue?

Only reason I have not tried that yet is because it will take a day or 2...

When runing check --repair directly on server instead of ssh still errors at the end:

260 orphaned objects found! Object with key b'\x10V\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' not found in repository /mnt/user/borg_backup. Traceback (most recent call last): File "borg/archiver.py", line 2089, in main File "borg/archiver.py", line 2025, in run File "borg/archiver.py", line 91, in wrapper File "borg/archiver.py", line 173, in do_check File "borg/archive.py", line 867, in check File "borg/archive.py", line 1165, in orphan_chunks_check File "borg/repository.py", line 550, in delete borg.repository.Repository.ObjectNotFound: Object with key b'\x10V\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' not found in repository /mnt/user/borg_backup.

Platform: Linux Backup 4.9.10-unRAID #1 SMP PREEMPT Wed Feb 15 09:38:14 PST 2017 x86_64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz Linux: Slackware 14.2 Borg: 1.0.10 Python: CPython 3.5.3 PID: 23562 CWD: /root sys.argv: ['borg', 'check', '-v', '--repair', '--archives-only', '/mnt/user/borg_backup/'] SSH_ORIGINAL_COMMAND: None

airbillion avatar Mar 06 '17 03:03 airbillion

What's also curious is the chunkid: b'\x10V\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' is highly improbable ID.

The all-zero ID would be the manifest, this one has just 6 (of 256) non-zero bits (and all 1 bits are within the first 3 bytes).

Usually chunkids are sha256(content) or hmac_sha256(content) and look like random.

Can you make sure your RAM is ok, like with memtest86+?

ThomasWaldmann avatar Mar 06 '17 03:03 ThomasWaldmann

Your client is a Xeon, does it have ECC memory? Your server is a i7, so I guess it is non-ECC.

ThomasWaldmann avatar Mar 06 '17 03:03 ThomasWaldmann

Primary server is xeon with ecc...backup server is i7 non-ecc...

re-ran the check --repair and found 9 less orphaned files:

251 orphaned objects found! Object with key b'\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc4\xfa/\x07\x00\x00\x00\x00Zt\x00\x00\x00\x00\x00\x00' not found in repository /mnt/user/borg_backup. Traceback (most recent call last): File "borg/archiver.py", line 2089, in main File "borg/archiver.py", line 2025, in run File "borg/archiver.py", line 91, in wrapper File "borg/archiver.py", line 173, in do_check File "borg/archive.py", line 867, in check File "borg/archive.py", line 1165, in orphan_chunks_check File "borg/repository.py", line 550, in delete borg.repository.Repository.ObjectNotFound: Object with key b'\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc4\xfa/\x07\x00\x00\x00\x00Zt\x00\x00\x00\x00\x00\x00' not found in repository /mnt/user/borg_backup.

Platform: Linux Backup 4.9.10-unRAID #1 SMP PREEMPT Wed Feb 15 09:38:14 PST 2017 x86_64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz Linux: Slackware 14.2 Borg: 1.0.10 Python: CPython 3.5.3 PID: 29344 CWD: /root sys.argv: ['borg', 'check', '-v', '--repair', '--archives-only', '/mnt/user/borg_backup/'] SSH_ORIGINAL_COMMAND: None

RAM should be fine...never had any issues prior to this...I have been using borg for a few months now without issue...

Is there a waty to re-build the cache or delete that chunk id?

airbillion avatar Mar 06 '17 03:03 airbillion

ran it again and found more orphaned files:

All disks on backup server are OK with SMART data test...

271 orphaned objects found! Object with key b'\x10V\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' not found in repository /mnt/user/borg_backup. Traceback (most recent call last): File "borg/archiver.py", line 2089, in main File "borg/archiver.py", line 2025, in run File "borg/archiver.py", line 91, in wrapper File "borg/archiver.py", line 173, in do_check File "borg/archive.py", line 867, in check File "borg/archive.py", line 1165, in orphan_chunks_check File "borg/repository.py", line 550, in delete borg.repository.Repository.ObjectNotFound: Object with key b'\x10V\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' not found in repository /mnt/user/borg_backup.

Platform: Linux Backup 4.9.10-unRAID #1 SMP PREEMPT Wed Feb 15 09:38:14 PST 2017 x86_64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz Linux: Slackware 14.2 Borg: 1.0.10 Python: CPython 3.5.3 PID: 2667 CWD: /root sys.argv: ['borg', 'check', '-v', '--repair', '--archives-only', '/mnt/user/borg_backup/'] SSH_ORIGINAL_COMMAND: None

airbillion avatar Mar 06 '17 03:03 airbillion

Something is instable there. I suggest you do not continue writing to the repo until you made sure your hw (client and repo server) is OK. After that, please also check layers above hw but below borg (like sw-raid? lvm? fs?) are OK also.

ThomasWaldmann avatar Mar 06 '17 04:03 ThomasWaldmann

Ok...all hardware and software seems ok...

Must have messed something up somewhere...I am running a check --repair on the whole repo to see if it can be repaired...

If it cannot I guess I'll have to redo the whole backup to another report...

airbillion avatar Mar 06 '17 19:03 airbillion

So, you ran memtest86+ for how many passes with how many errors as result?

Are these servers somehow exposed to untrusted users? Like being connected to the internet or users being able to run code on the server?

In case you restart with a new repository on the same hardware: please enable encryption, so we have MACs instead of just hashes.

ThomasWaldmann avatar Mar 06 '17 20:03 ThomasWaldmann

Only 1 pass...no errors..

Servers are not exposed to anyone but myself.

OK...will try encryption...still running the check --repair onthe whole repo...about 75% through after 24 hours...should finish by tomorrow morning.

Hopefully the repository-only check --repair can fix the issue and not error out...

I'll keep you posted.

airbillion avatar Mar 07 '17 15:03 airbillion

Can you give me precise date and utc time when these 2 different ObjectNotFound happened?

ThomasWaldmann avatar Mar 07 '17 20:03 ThomasWaldmann

good news!...the check --repair repository-only finally completed and was able to repair the repository. I then ran the check --repair archives-only and it completed after finding and removing the orphaned items...no more errors found at all!

This ordeal prompted me to create a few separate repos for my backups rather than one large repo...I think this will be better for a few reasons:

  1. repo/archive corruption will only affect a portion of my backups
  2. ability to have backups/checks run in parallel
  3. better control over archives/repos

Thank you for your help!

airbillion avatar Mar 09 '17 15:03 airbillion

Good to hear that borg check --repair worked for you. Still a bit unsatisfying though as it seems we did not find the root cause of the problems yet. Do you have the logs of the repair?

ThomasWaldmann avatar Mar 09 '17 15:03 ThomasWaldmann

see #2281

ThomasWaldmann avatar Mar 09 '17 23:03 ThomasWaldmann

Hmm, guess we won't be able to get more infos about this issue.

I still think this is some sort of corruption, maybe caused by a hardware issue.

I am closing this for now, please reopen or append to this issue if you get more information.

ThomasWaldmann avatar Mar 25 '17 14:03 ThomasWaldmann