[Borgbackup] borg recreate with changed segments_per_dir?
Sebastian Felis
sebastian.felis at gmx.de
Sun Jul 23 07:49:02 EDT 2017
On 22.07.2017 09:18, Sebastian Felis wrote:
> 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.
I wrote a small script to relocate the segments if segments_per_dir was
changed:
https://gist.github.com/xemle/4ac5c5d65d22b828198c32b0ac58a07c
borg check reported no issues after relocation
Cheers, Sebastian
More information about the Borgbackup
mailing list