[Borgbackup] borg recreate with changed segments_per_dir?

Sebastian Felis sebastian.felis at gmx.de
Sat Jul 22 03:18:48 EDT 2017


On 21.07.2017 22:24, Thomas Waldmann wrote:
>> Is there a way to recreate the repository data structure with changed
>> settings of segments_per_dir?
> 
> Not yet.
> 
> This has just come up on githb, see there:
> 
> https://github.com/borgbackup/borg/pull/2846

Thank you for the quick reply and the link. It seems that a automated 
relocation of segments wont be supported.


But the directory structure of segments seems to be simple. Please 
correct me if I am wrong:

tl;dr:

data/<segment_dir>/<segment_id>

where segment_dir is floor(<segment_id> / <segment_per_dir>)


Borg writes segments which ids (or names) are simple counter with offset 
of 1 for the next segment. The directory is created by dividing the 
current segment id by the segment_per_dir value.

So if I change the segment_per_dir value, I have to iterate through all 
segment ids, calculate the new segment_dir and move each segment file to 
the new calculated directory.


Example:

old segment_per_dir is 10000, new segment_per_dir is 450;

for segment 475332 the original segment dir would be 47 while the new 
one would be 1056 (475332 / 450).


If so, it would be fair simple to change segments_per_dir manually.

Sebastian


More information about the Borgbackup mailing list