Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set up a backup to a remote host #254

Closed
nikonakoneko opened this issue Mar 15, 2020 · 2 comments
Closed

How to set up a backup to a remote host #254

nikonakoneko opened this issue Mar 15, 2020 · 2 comments

Comments

@nikonakoneko
Copy link

nikonakoneko commented Mar 15, 2020

Hi,

I don't understand how I should set up my configuration to make my backup to a remote host (via ssh?)
I currently have

snapshot_root   /mnt/backup/rsnapshot
backup  /home/          localhost/
backup  /etc/           localhost/
backup  /usr/local/     localhost/

should I just change localhost by the name/IP of the server?

@StefanMoch
Copy link
Contributor

I don't understand how I should set up my configuration to make my backup to a remote host (via ssh?)

You cannot really do it this way (push to another server) with rsnapshot, as it pulls the backups to the machine it is running on. The backup machine needs the snapshot_root mounted locally. This directory can, however, be mounted from another server via NFS or similar, so that the data is physically on the other machine. Which may solve your problem.

I currently have

snapshot_root   /mnt/backup/rsnapshot
backup  /home/          localhost/
backup  /etc/           localhost/
backup  /usr/local/     localhost/

That backups the three directories to your backup directory in /mnt/backup/rsnapshot. If this directory is an NFS share, it should work.

should I just change localhost by the name/IP of the server?

That alone will just make your data backed up a directory with another name.

The usual setup (besides the local-only case) is: If you have one backup machine and want to backup other machines, rsnapshot is configured to login to the other machine via rsync over ssh and syncs to the folder in snapshot_root. (In your example /mnt/backup/rsnapshot/localhost/)

The second argument of the backup line (i.e. "localhost/" in your example) is the target directory in your snapshot_root. That should be changed if you backup another host, but it is not enough. You can name it like you want (the hostname is usually used), just make sure the backups of different hosts are synced to different target directories. The first argument also needs to be changed like root@hostname:/home and so on.

For configuration examples, see:
https://github.com/rsnapshot/rsnapshot/blob/master/rsnapshot.conf.default.in#L237

@sgpinkus sgpinkus closed this as completed Jun 4, 2021
@DrHyde
Copy link
Member

DrHyde commented Jun 4, 2021

It's worth noting that each backup directive should have a different target directory. This:

backup  /home/          localhost/
backup  /etc/           localhost/
backup  /usr/local/     localhost/

will first make the contents of $snapshot_root/localhost a copy of the contents of /home, and will immediately thereafter make the contents of $snapshot_root/localhost a copy of the contents of /etc. You will no longer have a backup of /home. And so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants