Atemu / Polardroid

Efficient Android backups using Borg via Nix
1 stars 0 forks source link

Use `borg` to generate an exact list of paths and sizes to pass to `ncdu` #2

Open Atemu opened 4 months ago

Atemu commented 4 months ago

Currently, there is a mismatch between the files which ncduCmd shows and what borgCmd actually backs up because the --exclude implementations are different. Additionally, borg's advanced patterns cannot be used if you want to use ncduCmd because it can't understand those.

ncdu can read a saved snapshot of the filesystem to explore. The format is super weird but it's possible to create automatically and thereby make ncdu make any filtered (or even entirely made up) structure explorable visually.

borg's create has the --dry-run --list flags which output a list of files that borg would back up. It should be possible to transform these into a format that ncdu can visualise.

Prior art exists at https://github.com/wodny/ncdu-export. Using its tools, it ought to be possible to do something like:

borg create ... --dry-run --list ... | ... | ./find2flat.py - | ./unflatten.py - | ncdu -f -
Atemu commented 2 weeks ago

Forgot to backlink but I have implemented support for borg create dry-runs here: https://github.com/wodny/ncdu-export/pull/4