...das minhas cousas

 


From the restic manual page:

“restic is a backup program which allows saving multiple revisions of files and directories in an encrypted repository stored on different backends.”

I will use restic to backup my org and dot files in the cloud. It has a good encryption(all files are encrypted with AES-256 in counter mode (CTR)), allows snapshotting and has a simple and easy command line interface.

First thing to do is initialize the new repository:

restic -r ~/backup/repository/path init

The ‘-r’ flag sets the repository location and the init command initialize the repository. If not passorwd file/command is indicated, a passorwd for the new repository will be asked.

Now make the backup with the command backup followed by the directories path:

restic -r ~/backup/repository/path backup $HOME/org-files $HOME/dot

<div class=“note”><span>NOTE</span>

“Symlinks are archived as symlinks, restic does not follow them." </div>

We can make a new backup with the previous command and/or add new directories and files.

To get a repository snapshots list will use the snapshots command:

restic -r ~/backup/repository/path snapshots

If we want to show the files in a snapshot, the ls command followed by the snapshot ID will do the job:

restic -r ~/backup/repository/path ls f06eca8c

Now to restore a snapshot will do it with the restore command and the snapshot ID:

restic -r ~/backup/repository/path restore f06eca8c --target /path/to/restore/the/snapshot

The option ‘–target’ set the path to restore the snapshot.

And to delete a snapshot use the command forget followed by the snapshot ID:

restic -r ~/backup/repository/path forget f06eca8c

The job is done and with the old friend cron to schedule the backups and the option ‘–passorwd-command’ in restic, we’ll automatize the backup every hour. Line in ‘crontab’ file:

0 * * * * restic --password-command="gpg2 -q --for-your-eyes-only --no-tty -d /path/to/resticpass.gpg" \
-r ~/backup/repository/path backup $HOME/org-files $HOME/dot