Skip to content

Back up and restore Windows Alternate Data Streams#5171

Open
aneesh-n wants to merge 15 commits intorestic:masterfrom
zmanda:windows_ads
Open

Back up and restore Windows Alternate Data Streams#5171
aneesh-n wants to merge 15 commits intorestic:masterfrom
zmanda:windows_ads

Conversation

@aneesh-n
Copy link
Copy Markdown
Contributor

@aneesh-n aneesh-n commented Dec 3, 2024

What does this PR change? What problem does it solve?

Restic did not back up Alternate Data Streams in Windows. Restic now backs up Alternate Data Streams (ADS) and restores them back to the main files.
The Alternate Data Streams are backed up like any other normal files, and the full name of the stream like 'file_name.txt:stream_name' is stored as the name of the file representing the ADS.
During restore, the ADS files are restored and attached to the original files as Alternate Data Streams. For progress and summary, the ADS are not counted in the "filesFinished" and "filesTotal" count, but the sizes of the ADS files are counted.

Was the change previously discussed in an issue or on the forum?

Closes #1401

Checklist

  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I'm done! This pull request is ready for review.

@aneesh-n
Copy link
Copy Markdown
Contributor Author

aneesh-n commented Dec 3, 2024

I removed the old PR and recreated this one as there were too many changes and many of the comments had become irrelevant.
This PR turned out to be larger than initially expected as there are many edge cases to be considered, and the test cases cover multiple scenarios and combinations with other windows attributes added from previous PRs. Probably more than half the code is test cases.
The commit sequence should help make it easier to review.
Parts of this code could potentially be done in a different way.

@vmlemon
Copy link
Copy Markdown
Contributor

vmlemon commented Dec 18, 2024

Thanks for implementing this. It seems to function pretty well, from trying a backup, with a patched copy of Restic, and being able to access the NTFS streams, from within a WSL mount of the repository is nice, but I haven't pushed it too hard, and can't give much in the way of code review.

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

Successfully merging this pull request may close these issues.

Does restic back up alternate data streams attached to NTFS files?

2 participants