Store default compression level when creating a new repository using `init`
Output of restic version
restic 0.15.2 compiled with go1.20.3 on darwin/arm64
How did you run restic exactly?
mt@client:~ restic --compression=off -r sftp:root@server:/data/restic2 init created restic repository e783d4b6a5 at sftp:root@server:/data/restic2
Please note that knowledge of your password is required to access the repository. Losing your password means that your data is irrecoverably lost. mt@client:~ restic cat config -r sftp:root@server:/data/restic2 repository e783d4b6 opened (version 2, compression level auto) created new cache in /Users/mt/Library/Caches/restic { "version": 2, "id": "e783d4b6a54d37f4433429dd3b6ba30a2b53b997aba32ba3bfea63b06d4554f3", "chunker_polynomial": "3fe4af48428fc5" } mt@client:~ mt@client:~ export RESTIC_COMPRESSION=off mt@client:~ restic --compression=off -r sftp:root@server:/data/restic2 init created restic repository afae15537e at sftp:root@server:/data/restic2
Please note that knowledge of your password is required to access the repository. Losing your password means that your data is irrecoverably lost. mt@client:~ restic cat config -r sftp:root@server:/data/restic2 repository afae1553 opened (version 2, compression level off) created new cache in /Users/mt/Library/Caches/restic { "version": 2, "id": "afae15537eb1e11e58c0a8ee6bac8b84fe4171e71748b1cb40c8b0302116b3eb", "chunker_polynomial": "2f0a0aa2b9004d" }
What backend/server/service did you use to store the repository?
sftp to zfs based dir on server
Expected behavior
compression being off when specifying --compression=off
Actual behavior
--compression=off is not honored, but environment variable RESTIC_COMPRESSION works as documented.
Steps to reproduce the behavior
see above, just create a repo with compression turned off.
Do you have any idea what may have caused this?
No.
Do you have an idea how to solve the issue?
No.
Did restic help you today? Did it make you happy in any way?
I am just starting to use it - looks like it is nice. I very much like that it is easy to install !
This is a cosmetic problem only. restic init does not actually use the compression setting, only restic backup does; it's a per-backup setting, not per-repo. I think only restic backup shouldt print the compression setting, separately from the repository info.
The log message prints the compression setting used for the current command. And it's already documented at https://restic.readthedocs.io/en/stable/047_tuning_backup_parameters.html#compression that the compression parameter only applied to a single run of restic.
So let's treat this issue as a feature request to add support for storing the compression level passed to init. This should probably complemented with support for changing the stored default compression level. The latter will add quiet a bit of complexity, so it likely won't happen soon.
Restic should allow add key value to repo config and some key to be used as default arguments. Something like :
restic config set default.compression max
Multiple arguments :
restic config append default.exclude rule
Remove index:
restic config del default.exclude index
Delete all
restic config del default.exclude
Also option to disable it, like: --no-defaults