Borg Backup failed: segment not found

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 30.0.4
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 22.04
  • Web server and version (e.g, Apache 2.4.25):
    • Apache 2.4.62
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • traefik 2.9.10
  • Is this the first time you’ve seen this error? (Yes / No):
    • No
  • When did this problem seem to first start?
    • Three days ago
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • AIO
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

I have issues with the automatic daily borg backup. They worked pretty good the whole time, but since three 3 there is an error stating, that borg failed to compact archives.

Steps to replicate it (hint: details matter!):

  1. Borg Backup Creation via Nextcloud AIO v10.2.0

Log entries

Nextcloud Borg Backup

2025-01-08T02:01:13.631555828Z Performing backup...
2025-01-08T02:01:13.631768353Z Starting the backup...
2025-01-08T02:01:15.299117196Z Creating archive at "/mnt/borgbackup/borg::20250108_020113-nextcloud-aio"
2025-01-08T02:03:14.946752267Z ------------------------------------------------------------------------------
2025-01-08T02:03:14.946794698Z Repository: /mnt/borgbackup/borg
2025-01-08T02:03:14.946804648Z Archive name: 20250108_020113-nextcloud-aio
2025-01-08T02:03:14.946813149Z Archive fingerprint: bc2e574a8c5c23d43d258c5e1897e3791a12e02fe5145623b0b4155940fc9c37
2025-01-08T02:03:14.946821709Z Time (start): Wed, 2025-01-08 02:01:15
2025-01-08T02:03:14.946829899Z Time (end):   Wed, 2025-01-08 02:03:12
2025-01-08T02:03:14.946838069Z Duration: 1 minutes 56.80 seconds
2025-01-08T02:03:14.946846499Z Number of files: 142607
2025-01-08T02:03:14.946855060Z Utilization of max. archive size: 0%
2025-01-08T02:03:14.946870790Z ------------------------------------------------------------------------------
2025-01-08T02:03:14.946879420Z                        Original size      Compressed size    Deduplicated size
2025-01-08T02:03:14.946887790Z This archive:               84.29 GB             70.17 GB            111.21 MB
2025-01-08T02:03:14.946896071Z All archives:                1.42 TB              1.17 TB             67.63 GB
2025-01-08T02:03:14.946904901Z 
2025-01-08T02:03:14.946912971Z                        Unique chunks         Total chunks
2025-01-08T02:03:14.946921051Z Chunk index:                  190359              2994838
2025-01-08T02:03:14.946931372Z ------------------------------------------------------------------------------
2025-01-08T02:03:15.103952124Z BORG_PRUNE_OPTS are --keep-within=7d --keep-weekly=4 --keep-monthly=6
2025-01-08T02:03:15.103981434Z Pruning the archives...
2025-01-08T02:03:18.978587371Z ------------------------------------------------------------------------------
2025-01-08T02:03:18.978629832Z                        Original size      Compressed size    Deduplicated size
2025-01-08T02:03:18.978640463Z Deleted data:              -84.32 GB            -70.19 GB            -90.48 MB
2025-01-08T02:03:18.978654643Z All archives:                1.33 TB              1.10 TB             67.54 GB
2025-01-08T02:03:18.978664023Z 
2025-01-08T02:03:18.978672963Z                        Unique chunks         Total chunks
2025-01-08T02:03:18.978683334Z Chunk index:                  189975              2823717
2025-01-08T02:03:18.978699194Z ------------------------------------------------------------------------------
2025-01-08T02:03:19.018186640Z Compacting the archives...
2025-01-08T02:03:19.627229187Z segment 181 not found, but listed in compaction data
2025-01-08T02:03:19.627268178Z segment 198 not found, but listed in compaction data
2025-01-08T02:03:19.627277949Z segment 199 not found, but listed in compaction data
2025-01-08T02:03:19.627326580Z segment 200 not found, but listed in compaction data
2025-01-08T02:03:19.627335740Z segment 201 not found, but listed in compaction data
2025-01-08T02:03:19.627344560Z segment 202 not found, but listed in compaction data
2025-01-08T02:03:19.627379171Z segment 203 not found, but listed in compaction data
2025-01-08T02:03:19.627405482Z segment 204 not found, but listed in compaction data
2025-01-08T02:03:22.980152625Z Local Exception
2025-01-08T02:03:22.980190786Z Traceback (most recent call last):
2025-01-08T02:03:22.980198896Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 5391, in main
2025-01-08T02:03:22.980206346Z     exit_code = archiver.run(args)
2025-01-08T02:03:22.980213346Z                 ^^^^^^^^^^^^^^^^^^
2025-01-08T02:03:22.980220236Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 5309, in run
2025-01-08T02:03:22.980227337Z     rc = func(args)
2025-01-08T02:03:22.980234067Z          ^^^^^^^^^^
2025-01-08T02:03:22.980240927Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 191, in wrapper
2025-01-08T02:03:22.980247957Z     return method(self, args, repository=repository, **kwargs)
2025-01-08T02:03:22.980254827Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-08T02:03:22.980261687Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 1887, in do_compact
2025-01-08T02:03:22.980269148Z     repository.commit(compact=True, threshold=threshold, cleanup_commits=args.cleanup_commits)
2025-01-08T02:03:22.980276198Z   File "/usr/lib/python3.12/site-packages/borg/repository.py", line 535, in commit
2025-01-08T02:03:22.980283178Z     self.compact_segments(threshold)
2025-01-08T02:03:22.980289948Z   File "/usr/lib/python3.12/site-packages/borg/repository.py", line 825, in compact_segments
2025-01-08T02:03:22.980296988Z     for tag, key, offset, data in self.io.iter_objects(segment, include_data=True):
2025-01-08T02:03:22.980303908Z                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-08T02:03:22.980310809Z   File "/usr/lib/python3.12/site-packages/borg/repository.py", line 1583, in iter_objects
2025-01-08T02:03:22.980317749Z     size, tag, key, data = self._read(fd, self.header_fmt, header, segment, offset,
2025-01-08T02:03:22.980324759Z                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-08T02:03:22.980331659Z   File "/usr/lib/python3.12/site-packages/borg/repository.py", line 1677, in _read
2025-01-08T02:03:22.980338689Z     data = fd.read(length)
2025-01-08T02:03:22.980345449Z            ^^^^^^^^^^^^^^^
2025-01-08T02:03:22.980352160Z OSError: [Errno 5] I/O error
2025-01-08T02:03:22.980358940Z 
2025-01-08T02:03:22.980365690Z Platform: Linux f9e900964448 5.15.0-127-generic #137-Ubuntu SMP Fri Nov 8 15:21:01 UTC 2024 x86_64
2025-01-08T02:03:22.980391211Z Linux: Unknown Linux  
2025-01-08T02:03:22.980398121Z Borg: 1.4.0  Python: CPython 3.12.8 msgpack: 1.0.8 fuse: llfuse 1.5.1 [pyfuse3,llfuse]
2025-01-08T02:03:22.980404921Z PID: 40  CWD: /
2025-01-08T02:03:22.980411521Z sys.argv: ['/usr/bin/borg', 'compact']
2025-01-08T02:03:22.980418221Z SSH_ORIGINAL_COMMAND: None
2025-01-08T02:03:22.980424811Z 
2025-01-08T02:03:23.005195811Z Failed to compact archives!

OSError: [Errno 5] I/O error

This error is coming from OS. Indicates a filesystem matter such as failing hardware or other corruption (e.g. power loss, OS bug, network I/O if a network-based file system, etc.)

There may be clues in your host OS kernel logs. Or it may require more digging at that level. Simple things to do are to check the logs, run fsck, etc.

Check favorite search engine. Also you can search the forum for some past scenarios. It’s outside AIO/Borg.

2 Likes

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.