Last active
November 30, 2019 02:54
-
-
Save liejuntao001/5b1e7a119e289f43d1ca56f2480d6eba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create .restic.env with the values: | |
export RESTIC_REPOSITORY= | |
export RESTIC_PASSWORD= | |
# if using s3 as backend | |
export AWS_ACCESS_KEY_ID= | |
export AWS_SECRET_ACCESS_KEY= | |
# test if the restic repository exist. if this gives error, create it | |
restic snapshots | |
# init a repository | |
if [ $? -ne 0 ]; then | |
restic init | |
fi | |
# create a backup with tag | |
restic backup \ | |
--exclude-caches \ | |
--tag $tag \ | |
$backup_path | |
# prune the backups | |
restic forget --prune --keep-daily 7 --keep-weekly 4 --keep-monthly 6 | |
# run backup without root but be able to read all files | |
https://restic.readthedocs.io/en/latest/080_examples.html#backing-up-your-system-without-running-restic-as-root | |
# mount | |
restic mount /mnt/test_mount | |
VOLUME_NAME=test_volume; source ~/restic/.restic_volume.env ; restic mount /mnt/test_mount | |
# restore. Use the "ID" of a snapshot instead of tag | |
restic restore 00ecfb80 --target /temp/temp_recover/ | |
VOLUME_NAME=test_volume; source ~/restic/.restic_volume.env ; restic restore 00ecfb80 --target /temp/temp_recover/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment