Back up files
Create a snapshot of a directory in an existing repository.
Before you begin
- Create a repository. This topic uses
/tmp/restic-demo-repo.
Steps
-
Create a sample directory that contains one file:
bash mkdir ~/docpilot-sample echo "hello" > ~/docpilot-sample/notes.txt -
Run the backup command:
bash restic backup ~/docpilot-sample --repo /tmp/restic-demo-repo -
Enter the repository password when prompted.
Restic prints a summary of new and changed files, then
snapshotfollowed by the new snapshot ID and the wordsaved. -
List the snapshots to confirm the backup:
bash restic snapshots --repo /tmp/restic-demo-repoThe table has the columns ID, Time, Host, Tags, Paths and Size, and lists one snapshot.
Exclude files from a backup
Add the --exclude flag to skip files that match a pattern:
restic backup ~/docpilot-sample --exclude "*.tmp" --repo /tmp/restic-demo-repo
Next steps
Continue with Restore a snapshot.