Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: include 'bytes added to repository' in progress line while backing up #4736

Open
mhansen opened this issue Mar 26, 2024 · 1 comment

Comments

@mhansen
Copy link

mhansen commented Mar 26, 2024

$ restic version
restic 0.16.4 compiled with go1.21.6 on darwin/arm64

What should restic do differently? Which functionality do you think we should add?

Restic has a curses-style CLI status line that updates a few times a second as the backup is happening, with time, total scanned size, total directory size. e.g.:

[0:04] 160 files 142.814 MiB, total 429 files 295.206 MiB, 0 errors

I propose adding the 'total bytes added to repository so far' statistic to this line.

This is printed out at the end:

Added to the repository: 5.677 GiB (5.569 GiB stored)

But it would be reassuring to also print this during the backup.

As an extension, most of the other statistics would be great to show during the backup too:

Files:       168196 new,     0 changed,     0 unmodified
Dirs:          318 new,     0 changed,     0 unmodified
Data Blobs:   9439 new
Tree Blobs:    319 new
Added to the repository: 5.677 GiB (5.569 GiB stored)

What are you trying to do? What problem would this solve?

I'm backing up my Google Photos with Google Takeout every 2 months. Any given backup has very little new data. I'd like to see while I'm backing up how much new data has been added to the repository, so (mostly) I can be confident that it's working, and (less likely) Ctrl-C if it's backing up too much new stuff.

Did restic help you today? Did it make you happy in any way?

Yeah, restic rules. Love that it's open-source, deduping, cross-platform, and fast. It's how I'm backing up my Google Photos: https://www.markhansen.co.nz/google-photos-backup/

Code pointers

Here's the code that prints the status line:

status = fmt.Sprintf("[%s] %s%v files %s, total %v files %v, %d errors%s",

I see this doesn't have easy access to the total bytes added to the repository; it would need to be plumbed from https://github.com/restic/restic/blob/master/internal/ui/backup/progress.go#L88 (and even further back).

I see this is used by both backup and restore commands. Maybe not all statistics make sense for both commands.

@MichaelEischer
Copy link
Member

After #4705 is merged, this shouldn't be too hard to implement. The console output of backup and restore are independent enough to not pose a problem here.

However, I can imagine that the output could be too verbose by default, but it is probably okay for backup -v.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants