borg icon indicating copy to clipboard operation
borg copied to clipboard

empty folders in repo_dir/data/ are not automatically removed

Open daniel156161 opened this issue 3 years ago • 1 comments

Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

Is this a BUG / ISSUE report or a QUESTION?

QUESTION

System information. For client/server mode post info for both machines.

Your borg version (borg -V).

1.2.0

Operating system (distribution) and version.

Distribution: Manjaro Linux Release: 21.3.1 Codename: Ruah

Hardware / network configuration, and filesystems used.

Running a borg Server into a Docker Container with Version 1.2.0

How much data is handled by borg?

------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
All archives:               94.82 GB             71.92 GB             36.81 GB

                       Unique chunks         Total chunks
Chunk index:                  208674               530953

Full borg commandline that lead to the problem (leave away excludes and passwords)

borg compact --cleanup-commits

Describe the problem you're observing.

Having into the Borg Repo Data Folder many empty Folders, overall 11 Folders and 7 Folders are empty

Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.

created many Backups over the time and prune the old ones, use Command above and have 7 empty Folders

Question

Can i delete the empty Folders or do borg neat them in any way? Can borg delete this empty folders automatically?

daniel156161 avatar Jun 30 '22 16:06 daniel156161

i don't think the empty folders are needed, so if they bother you, you can delete them.

maybe avoid running borg in parallel while you manually delete stuff in the repo - and be careful.

BTW:

  • 1.2.1 is out
  • only run borg compact --cleanup-commits once after upgrading from 1.1, you should not always run it with --cleanup-commits as the bug was only present in 1.1.x and was fixed in 1.2.

yeah, deleting the empty dirs automatically is a good idea guess would be a good additional job for borg compact.

ThomasWaldmann avatar Jun 30 '22 17:06 ThomasWaldmann

What issue am I to resolve here

manny-uncharted avatar Oct 28 '22 22:10 manny-uncharted

by compact the repository the old files will be remove and then i had some empty folders

daniel156161 avatar Nov 13 '22 18:11 daniel156161

Taking a look at this.

nain-F49FF806 avatar May 18 '23 04:05 nain-F49FF806

Have looked into the repository module code that deals with compacting. While writing a new segment, when segment_num % self.segments_per_dir is 0, LoggedIO.get_write_fd creates a new directory to place the segment. But these directories are never cleared during the prune/compact process.

I've written a patch that adds a function in LoggedIO to additionally clear empty directories at the end of the compact process.

nain-F49FF806 avatar May 21 '23 17:05 nain-F49FF806