6

I want to use rsnapshot for remote backups of my websites.

It is not clear this line in rsnapshot.conf:

snapshot_root   /.snapshots/

In the documentation, it says snapshots are stored in this directory, but I actually want them to be stored on a remote server and this is specified later with the line

backup local_folder remote_server

so what's snapshot_root then ?

Jorge Castro
  • 71,754
aneuryzm
  • 869

2 Answers2

6

snapshot_root is the root for the paths you specify under backup.

For example:

snapshot_root  /var/backups/me/
...
backup /home/me/movies/ /media/
backup /home/me/music/  /media/
backup /home/me/drafts/ /documents/

After running rsnapshot hourly, for example, the snapshots would be stored under

/var/backups/me/hourly.0/media
/var/backups/me/hourly.0/documents

The snapshot target must be a local filesystem (although the source can be remote).

I think the simplest option is to put the rsnapshot service on the remote server, and let it copy from your webserver. Using ssh, it would look something like

snapshot_root  /var/backups/me/
...
backup me@example.com:/home/me/movies/ /media/

You would need to have the ssh daemon running on the "example.com" box, and configured so that the user (here "me") can ssh into "example.com" without being asked for a password.

See the rsnapshot HOWTO (section 4.3.8 Backup) for more details.

j-g-faustus
  • 5,538
  • @j-g-faustus So I can for example specify snapshot_root user@myserver.com/ and then backup /var/www/localfolder/ /remoteFolder/ ? Are the trailing slashes correctly added ? – aneuryzm Jan 08 '11 at 14:21
  • 1
    Yes, that should work. The trailing slashes are correct, rsnapshot is a bit picky on that :) See also the howto: http://rsnapshot.org/howto/1.2/rsnapshot-HOWTO.en.html#modifying_the_config_file – j-g-faustus Jan 08 '11 at 14:29
  • @j-g-faustus Sorry, I've just tried now and I get this ERROR: snapshot_root user@myserver.com/ - snapshot_root \ must be a full path – aneuryzm Jan 08 '11 at 15:04
  • Probably because I can only mount the server first ? So should I run something like mnt servername.com ? – aneuryzm Jan 08 '11 at 15:06
  • Ah, sorry. The snapshot target, the place you are writing to, must be a local filesystem - only the source can be remote. Mounting might work if under some circumstances, but not in the general case, I think. – j-g-faustus Jan 08 '11 at 16:06
  • @j-g-faustus Does this mean that rsnapshot should be installed on the backup server and not on the production server !?!? – aneuryzm Jan 09 '11 at 08:41
  • I've just realized I don't have sudo privilegies on the backup server. Does this mean that I cannot use rsnapshot then ? – aneuryzm Jan 09 '11 at 08:59
  • I've also used -o allowroot option when I was mounting the backup server but when I run rsnapshot I got errors (no permissions.. etc). I guess I cannot really do it.. but please let me know if this is not true. – aneuryzm Jan 09 '11 at 09:18
  • @Patrick Yes, that's what it means. I would try mounting first - I know it doesn't work over a Samba network, but if you are on NFS it might be worth a try. Re: sudo: Don't you know about someone who has sudo privileges, so you can talk them into installing rsnapshot for you? If not, no - not as far as I know. – j-g-faustus Jan 09 '11 at 09:19
  • @j-g-faustus I've just mounted the backup server. However, I got permissions errors when I run the backup command. I get this is due to the mounted folder. I've sent an email to support, but they provide backup space and that's it.. I don't think they will give me sudo privilegies. – aneuryzm Jan 09 '11 at 09:23
  • @Patrick You could try posting the permissions error here as a separate question. But as far as I know, rsnapshot cannot push a backup somewhere else, it can only pull from another machine and store it locally. – j-g-faustus Jan 09 '11 at 09:37
1

I had the same issue... and discovered that if I locally mount a folder from the remote system, then rsnapshot will allow me to set the "snapshot_root" configuration parameter to point to it.

This then allows me to store my snapshots and my backup on the same remote server.

eg.

Mount a folder from the remote system

mount 192.168.0.2:/volume1/Backup /mnt/Backup

Set the "snapshot_root" configuration parameter to point the mounted folder

snapshot_root /mnt/Backup/rsnapshot/

Set a rsnapshot backup point to backup a local folder remotely

backup /home/backup-source user@192.168.0.2:/volume1/Backup/backup-target/ rsync_short_args=-trvsz

Note: Although I could have simply designated the mounted remote folder instead as a backup destination, (see below), this would not have enabled me to utilise the Rsync server running on the remote target, (in this case a Synology NAS). I used shared keys to allow rsnapshot to access the remote backup target without a password

backup /home/backup-source /mnt/Backup/backup-target/ rsync_short_args=-trvsz

Rat
  • 11