borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
11.24k stars 744 forks source link

soft delete / undelete #8515

Closed ThomasWaldmann closed 2 weeks ago

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 83.08824% with 23 lines in your changes missing coverage. Please review.

Project coverage is 81.75%. Comparing base (5fc7208) to head (142a739). Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
src/borg/archive.py 57.14% 7 Missing and 2 partials :warning:
src/borg/archiver/undelete_cmd.py 84.61% 5 Missing and 3 partials :warning:
src/borg/archiver/check_cmd.py 0.00% 1 Missing and 1 partial :warning:
src/borg/archiver/compact_cmd.py 75.00% 2 Missing :warning:
src/borg/manifest.py 93.33% 0 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #8515 +/- ## ========================================== + Coverage 81.47% 81.75% +0.28% ========================================== Files 73 74 +1 Lines 13142 13240 +98 Branches 1927 1941 +14 ========================================== + Hits 10707 10824 +117 + Misses 1770 1753 -17 + Partials 665 663 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

PhrozenByte commented 2 weeks ago

What do you think about also updating the compact epilog to mention all the things users should know?

            Free repository space by deleting unused chunks.

            ``borg compact`` iterates over all chunks of data the repo consists
            of and checks whether they are used by any archive in the archives
            directory. All chunks that aren't referenced by any archive are
            then deleted from the filesystem to free disk space. This most
            notably includes all archives that were previously internally
            marked for deletion ("soft-deleted archives") by the delete and
            prune commands. Running the compact command consequently also
            impedes ``borg undelete`` from undeleting any soft-deleted
            archives. ``borg compact`` also removes not needed junk data from
            previous backups, e.g. data of aborted backups, files that had to
            be skipped due to I/O errors and other issues that arised while
            creating previous backups.

            You usually don't want to run ``borg compact`` after every write
            operation on the repository, but either regularly (e.g. once a
            month, possibly together with ``borg check``) or when disk space
            needs to be freed.

            **Important:** ``borg compact`` doesn't just remove data from
            intentionally deleted archives and junk data, but might in rare
            cases also delete data from archives that weren't intentionally
            deleted, but "lost" due to data corruption on a filesystem or
            hardware level. Such archives could potentially be restored with
            ``borg check --find-lost-archives [--repair]``, but note that
            finding such lost archives is a very time consuming task one
            usually doesn't want to take unless there are signs of lost
            archives (e.g. when seeing fatal errors when creating backups or
            when archives are missing in ``borg list``).

            Differently than borg 1.x, borg2's compact needs the borg key
            if the repo is encrypted.
ThomasWaldmann commented 2 weeks ago

I thought about it:

I will remove all user docs of "soft-deleted" again from borg and only explain what's happening in borg undelete and/or borg compact command, where it is somehow relevant.

Mentioning it all over the place isn't necessarily helpful, explaining it everywhere makes the docs longer than necessary.

ThomasWaldmann commented 2 weeks ago

@PhrozenByte I did it a bit differently, but hopefully giving all the information that is useful to the user (and not just an implementation detail).

ThomasWaldmann commented 2 weeks ago

I suggest you apply all your suggestions in a separate PR. I already mentioned that applying suggestions via the github UI doesn't always work. Then it sometimes also causes black to fail and in the end it is tedious to process here.