-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Backup to S3 Glacier archive triers make backups unusable/broken without cache #4583
Description
Output of restic version
restic 0.16.2 compiled with go1.21.3 on linux/arm64
What backend/service did you use to store the repository?
AWS S3
Problem description / Steps to reproduce
If you upload backups to S3 with -o s3.storage-class=GLACIER or -o s3.storage-class=DEEP_ARCHIVE it makes your repository partially broken.
If you try to exec restic snapshots from another host, or using --no-cache flag the output for this would be:
$ restic snapshots
repository fffffffff opened (version 1)
Load(<snapshot/aaaaaaaaa>, 0, 0) returned error, retrying after 508.626707ms: The operation is not valid for the object's storage class
Load(<snapshot/bbbbbbbb>, 0, 0) returned error, retrying after 308.071881ms: The operation is not valid for the object's storage class
Load(<snapshot/aaaaaaaaa>, 0, 0) returned error, retrying after 1.014433406s: The operation is not valid for the object's storage class
Load(<snapshot/bbbbbbbbb>, 0, 0) returned error, retrying after 400.917258ms: The operation is not valid for the object's storage class
Load(<snapshot/bbbbbbbbb>, 0, 0) returned error, retrying after 812.242443ms: The operation is not valid for the object's storage class
signal interrupt received, cleaning up
Ignoring "aaaaaaaaaaaa...": failed to load snapshot aaaaaaaaaa: context canceled
Ignoring "bbbbbbbbbbb...": failed to load snapshot bbbbbbbbb: context canceled
ID Time Host Tags Paths
------------------------------------------------------------------------------------
cccccccc 2023-12-04 00:15:45 my-host /home/LICENSE
ddddddd 2023-12-04 13:51:33 my-host /mnt/media/photo
eeeeeeee 2023-12-04 23:21:57 my-host /home/README.md
------------------------------------------------------------------------------------
3 snapshots
To get this output I executed restic snapshots, and soon after I got few errors - clicked CTRL+C.
Here you can see, in the repository with 5 (A, B, C, D, E) uploaded snapshots, 2 of them (A, B) are uploaded to the Glacier Flexible and Glacier Deep Archive tiers.
This issue not persists to the GLACIER_IR storage class, because all files are 'instant retrieval', so no issue here (the C-snapshot).
It is expected that if data is archived - it needed to be 'retrieved' beforehand in the AWS. And when I did so (on the machine with cache) - I was able to restic restore it.
Expected behavior
When non-instant retrieval storage class is opted-in - metadata is stored in STANDARD storage class, while packfile data is saved to specified tier.
Actual behavior
Snapshot metadata is unreachable because it is also stored in specified storage class.
Do you have any idea what may have caused this?
yes. It is because all files sent to the same tier without filtering metadata.
I've made a fallback fix for this issue, which I tested and it's working as intended: Ignore storage class option for metadata if sotrage class is either GLACIER or DEEP_ARCHIVE
Did restic help you today? Did it make you happy in any way?
Yup, I became quite enthusiastic about opportunity to safely backup significant media in cold storage for affordable money, so I tried this myself, and only after found out that I can't access them from another machine. And I even promoted this feature to friend, before trying it myself. So that's why I'm about to create the PR.