How to backup from different folders in the same repository?

I already use restic on 4 Linux Servers to SFTP on other machine & 1 Windows machine (with STFP backup via
All works great. This is a great backupsolution.

I have a very simple and basic question (sorry):

However in all cases I just backup one folder including subfolders per repository.
Now I would like to add other folders.

So, I currently use:
restic -r backup --verbose /var/mail

How should I backup another folder?
Example if I copy both /var/mal and /home/users/username to a folder /backup I will have a messup of both folders.

Will the backupserver understand, that these are from different orgins when I just use it like this? Or do I have to do this differently to avoid creating a mess?

restic -r backup --verbose /home/users/username

Thank you.

PS: Is there a best practice suggestion (exclude files, etc.) on how to backup a debian server?

This is actually really simple. If you run restic help backup it’ll tell you that the syntax for the backup command is restic backup [flags] FILE/DIR [FILE/DIR] .... The FILE/DIR [FILE/DIR] ... part there means “at least one FILE/DIR, optionally followed by another FILE/DIR, and optionally more of this”. So just add the other files/folders/paths you want to back up to the same command (don’t forget to quote those that have spaces in them, as you separate the paths you name in the command with spaces).

Not sure what you mean by origin. But in short, just list whichever paths you want to back up in one and the same restic command, on each host. You can then run the snapshots command to list the snapshots you have in your repository - you will see which paths each snapshot has backed up.

Not really - it depends on your use case. Some people prefer to back up their entire system by backing up / with the --one-file-system and using e.g. --exclude or similar to exclude things like /proc, /dev and so on. Personally I would not do that, instead I would only back up the data I want, e.g. ~ and maybe some /var/mail or whatever. If I have the situation that the entire system is lost, I will just reinstall it (doesn’t take much time) and restore my data.

1 Like

restic basically uses 3 ways to distinguish backups from each other: hostname, tags and path. You can use these 3 when working with commands like snapshots, find, ls or forget to narrow the output down.

Something that has been working very well for me is using 3 ‘sets’ of backup for every server: configuration, data and logs.

ID        Time                 Host                   Tags        Paths
0f1bc952  2020-12-05 11:09:20   data        /srv/vmail
d1818653  2020-12-05 11:09:32   logs        /var/log
4601027f  2020-12-05 11:09:44   config      /etc
20c1acae  2020-12-05 11:12:26    data        /srv/www
915672da  2020-12-05 11:12:36    logs        /var/log
1e0870f0  2020-12-05 11:12:45    config      /etc

This makes it easy to apply different prune policies independent of the path (i.e. restic forget --group-by host,tags --tag data --keep-daily 30 and restic forget --group-by host,tags --tag logs --keep-weekly 12).

In short: you might think about using tags as this makes dealing with different (changing) paths a lot easier.

1 Like

I think what you’re getting at here is “if I specify multiple backup source directories, will they get combined into one directory in the backup?” The answer is no, restic will keep these directories separate in the snapshot. You can confirm this by running a backup with two source directories and then running restic ls on the newly-created snapshot. You will see that the source directories are not merged.

As a side note, restic doesn’t have a backup server; all of the backup logic is in the client. The repository can be dumb storage (just a directory, or S3, etc.).

1 Like