Backup multiple servers to one restic repo

Hi all.

Just started using restic for backups.

Need advice on my backup help, so i have multiple VMs, which i need backup docker volumes

example each VM will have a /opt/docker directory, and each docker container will have its own folder.

example
#VM 1
/opt/docker/uptime-kuma
/opt/docker/gitea
/opt/docker/n8n
/opt/docker/postgres

#VM 2
/opt/docker/piped
/opt/docker/mysql
/opt/docker/adgauard
 
#VM 3
/opt/docker/invoiceninja
/opt/docker/homepage
 
#VM 4
/opt/docker/caddy
/opt/docker/jellyfin 

I want to backup each /opt/docker directory into one restic repo, where the repo will be on NAS via NFS mount.

How can i achieve this? each host will have restic and nfs mount

restic -r path/to/repo backup /opt/docker

Hint 1: Backing up the data folder of a running MySQL instance is not a good idea. You want to either stop that service prior to backing up or, even better, make a database dump and back that up at the same time you backup the rest of the application files to make sure you have a consistant set of files that can be successfully restored. Which you regularily want to test anyway.

Hint 2: Consider using a single restic repo if you expect to be backing up the same data multiple times. That way you can enjoy the benefits of restic’s deduplication functionality and save a lot of space on the backup locations.

thanks for the reply

thanks for the hints, sure will stopping serivec prior to backup.

so just to confirm if backup to the same repo from different vms wont be a problem.

eg.

2:10am - vm 1 runs `restic -r /mnt/vmbackups/vmbp-repo backup /opt/docker/vm1``

2:20am - vm 2 runs `restic -r /mnt/vmbackups/vmbp-repo backup /opt/docker/vm2`

2:30am - vm 3 runs `restic -r /mnt/vmbackups/vmbp-repo backup /opt/docker/vm3`

2:40am - vm 4 runs `restic -r /mnt/vmbackups/vmbp-repo backup /opt/docker/vm4

thinking having theses set on the script unlock , check before each backup from each VM

That will work. Use one repo if deduplication is possible and wanted or multiple repos if you want to be able to, say, one day split repos to different drives. It depends on your use case.

thanks Nico for your input and opinion.

1 Like

@adamol try a restore and see if you can easily identify the different VM.
If not then I would suggest to look at tagging and hostname during backup. These are the major differentiators for restic to filter snapshots.

UPDATE: I forgot there are also options for --path at snapshots and restore commands so you’d likely have no problems at all.

thanks for your input Billy

I suggest to use a single repo.

Also read about tags option for backup command. Tags will help to work with snapshots and filter them using human readable names.

1 Like

totally single repo will be the solution

@nicnab @Ilya Hello, everyone. I would appreciate your advice. I still don’t understand why you recommend a single repository. What’s the point? He’ll get the same deduplicated storage, but with more flexible settings, right? The number of storage units doesn’t affect the amount of space occupied.

What do you mean by “storage unit”? If you have two restic repos for two hosts with identical data, you need twice the space compared to a single, shared repo. Of course two hosts will rarely be exactly the same but even if they have 10% overlay in their data, you save 10% storage space. The only downside is that it’s harder to separate the two hosts to different storage spaces later. It’s not impossible but you have to do some work.

1 Like