Skip to content

Instantly share code, notes, and snippets.

@bradfa
Last active December 22, 2021 18:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bradfa/38a16172773caed9a750287be5503faf to your computer and use it in GitHub Desktop.
Save bradfa/38a16172773caed9a750287be5503faf to your computer and use it in GitHub Desktop.
Restic Notes
# Exclude poky default build dir
git/poky/build
# Exclude our sstate, downloads, and build output dirs
mr-oe-*/sstate-cache
mr-oe-*/downloads
mr-oe-*/*-oe-build/tmp-*
git/poky-wrap/titan
git/poky-wrap/downloads
git/poky-wrap/sstate-cache
# Exclude virt-manager and downloads dirs
virt-manager
downloads

Goal is to backup entire home directory and /etc on a daily basis. This will include qcow2 images for win10 VM.

Using restic to do a backup

  1. Created /mnt/restic/ disk on 4 TB spinning SATA drive.
  2. Created directory /mnt/restic/restic-repo/ to store data in
  3. Create a password file with just the password string at ~/.restic.passwd
  4. Run initial repo creation sudo restic init --repo=/mnt/restic/restic-repo/
  5. Run backup on kaim-eeyore machine to internal 4 TB disk with: sudo restic backup --repo=/mnt/restic/restic-repo/ --exclude-caches --one-file-system --password-file=/home/andrew/.restic.passwd --exclude-file=/home/andrew/.restic.excludes --verbose /etc/ /home/andrew/ /mnt/intel750/
  6. Run backup on kaim-eeyore or piglet to external 750 GB USB disk (after mounting with cryptsetup) with: sudo restic backup --repo=/mnt/tosh/restic-repo/ --exclude-caches --one-file-system --password-file=/home/andrew/.restic.tosh.passwd --exclude-file=/home/andrew/.restic.tosh.excludes --verbose /etc/ /home/andrew/ /mnt/intel750/ but ignore the intel750 path for piglet.

Using the FUSE mount for restores

  1. Make a /mnt/restic-fuse directory: sudo mkdir /mnt/restic-fuse
  2. Mount, via FUSE, the restic repo: sudo restic mount /mnt/restic-fuse --repo=/mnt/restic/restic-repo/ --password-file=/home/andrew/.restic.passwd --verbose
  3. Go grab the files you need from /mnt/restic-fuse/
  4. Ctrl-C to exit from the restic mounting

TODO:

I still need to:

  1. Create a list of excludes (ie: downloads and sstate-cache for yocto builds). Done, see --exclude=file= above.
  2. Determine a sane forget/purge strategy, to only keep the last X backup snapshots.
  3. Setup a crontab to run every night.
  4. Understand what impact running restic with win10 VM running has, as the backedup qcow2 images will be while Windows can write to "disk." So long as we sudo virsh suspend win10 then do the backup then sudo virsh resume win10 then at least Windows won't modify the disk during the backup, although booting from it afterwards may look like an unclean shutdown.
  5. Understand the dedup of large files that only slightly change (dedup is file based or block based?). The dedup looks to be block based for large files (https://restic.readthedocs.io/en/stable/100_references.html#backups-and-deduplication) and this appears to work both across and within files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment