**** DONE Restic Backup on Windows 10 with Babun/Cygwin :blog:software:windows: CLOSED: [2018-05-31 Thu 10:12] :PROPERTIES: :CREATED: [2018-05-31 Thu 09:38] :ID: 2018-05-31-restic-cygwin :END: :LOGBOOK: - State "DONE" from "DONE" [2019-03-13 Wed 13:51] - State "DONE" from [2018-05-31 Thu 10:12] :END: Update 2019-03-13: comments Florian. [[https://media.ccc.de/v/GLT18_-_378_-__-_g_ap147_005_-_201804281245_-_lightning_talks][I heard]] great things about [[https://restic.net/][restic]] for solving the backup requirement. Since it does also support Windows, I gave it a try on my business Windows 10 and my [[http://babun.github.io/][babun]] environment, which is a user-land [[https://en.wikipedia.org/wiki/Cygwin][Cygwin]] with better presets. Here are my findings. ***** Installation I downloaded restic [[https://github.com/restic/restic/releases/][from its GitHub release page]] (v0.9.0) and according to [[https://restic.net/#installation][the installation documentation]] I moved it to =C:\Windows\System32\= which I found a bit odd recommendation, modifying the sub-hierarchy of Windows system files. So far, I moved files to a directory which is part of the PATH environment variable. This time, I followed the instructions strictly. The [[https://restic.readthedocs.io/en/stable/020_installation.html#autocompletion][bash/zsh autocompletion setup]] did not work on my babun-zsh and I did not invest time to debug this issue. I guess it relates to not knowing where to store the resulting file. ***** Setting up a New Repository As far as I understood the documentation, restic follows some ideas of [[https://git-scm.com/][Git]]. It is chunk-based, identifies files with hashes (renaming and moving files do not result in additional backup effort), de-duplicates files, and uses so called repositories to store backups. Further more, it seems to be the case that restic is able to store backups from multiple locations in one single repository. Very cool: repository encryption is built-in right from the start. And this is where I had to get creative: there is [[https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#password-prompt-on-windows][a known issue with the password prompt on Windows]]. I could have installed a thing called winpty (I don't know so far). However, I chose to try a different approach: storing a long passphrase in a text file and use the =--password-file= command line option. And it worked: without the =--password-file= option, restic was stuck without any error or warning message. With the option, restic was able to initialize the repository: : export PWFILE=path/to/keyfile : restic init --repo "T:\restic-backup" --password-file $PWFILE As you might notice, restic on Cygwin needs Windows-style paths. Cygwin usually uses paths like =/cygdrive/t/restic-backup/= but restic does not accept them or handles them in a wrong way. You have to use Windows-style paths, not being able to use shell completion for paths. ***** Backup My first backup was easily done: : restic -r "T:\restic-backup" --verbose backup \ : "C:\Users\karl.voit\data" --password-file $PWFILE Yes, it's true: restic is fast. The same command runs an update on the backup and a new snapshot is created. ***** Curating Backups List all snapshots of a repository is done like: : restic -r "T:\restic-backup" snapshots --password-file $PWFILE Something that worries me a bit is the necessity of the recommendation to periodically check the integrity of a backup. This can be done with: : restic -r "T:\restic-backup" check --password-file $PWFILE ***** Restore Restoring a single file is easy: : restic -r "T:\restic-backup" restore latest \ : --target C:\Users\karl.voit\restore-test \ : --include "relative\path\file.txt" \ : --password-file $PWFILE I found out that using absolute paths for =--include= did not work: restic returned with no error or visible result. So please do use relative paths for include or exclude statements. ***** Summary It was nice to see that restic is a clever backup solution with built-in encryption that even works on Cygwin-like environments. There are some drawbacks such as the missing path completion on Cygwin/zsh and some trial and error around using absolute or relative path names for this and that. I am not sure why the manual mentions the necessity of periodically checking the integrity of repositories. This might indicate issues where restic corrupts repositories or this might just indicate the possibility of errors introduced by external things. I am not using restic for the time being. This is not related to restic itself but other circumstances in our Windows environment. However, it is good to know that there is something out there which might replace my hand-crafted rsync-scripts some day. ***** Comments :PROPERTIES: :END: Florian wrote me that he did not face any issue with the password prompt on Windows 10 with Restic 0.9.4 and PowerShell ISE. Related to "periodically checking the integrity of repositories", Florian thinks that this refers to other people modifying the repository like deleting a file or losing data by [[https://en.wikipedia.org/wiki/Soft_error][bit-flips]] on the storage media.