| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| efficient_backups_with_rsnapshot [2009/12/02 07:23] – tkbletsc | efficient_backups_with_rsnapshot [2026/02/21 08:58] (current) – tkbletsc |
|---|
| ====== Efficient backups with rsnapshot ====== | ====== Efficient backups with rsnapshot ====== |
| |
| (I need to write a full article here, but I don't have time now. Basically: stick rsnapshot on a Linux box, set up SSH keys to get into hosts you want to back up, deploy a secure rsync wrapper when you configure the host SSH key for backup access, then set up a cron job to run the thing.) | Basically, do this: [[https://documentation.ubuntu.com/server/how-to/backups/install-rsnapshot/|https://documentation.ubuntu.com/server/how-to/backups/install-rsnapshot/]] |
| |
| ===== Backing up Windows hosts ===== | Reminder: on debian/ubuntu, you may need to "sudo apt-get install liblchown-perl" so rsnapshot can set symlink ownership. |
| |
| Normally, all you'd need to do to make the server back up Windows hosts is to install Cygwin with SSH and rsync and set up SSH keys as normal. Unfortunately, there's a bug in cygwin that causes rsync over SSH to hang on certain directory trees, and this bug hasn't been solved in years (way to go, open source!). | To restrict the ability of the client to access or even change files on the server being backed up, use [[https://github.com/tkbletsc/rrsync|my rrsync.py]], or perhaps the one from the rsync project. |
| |
| So we'll set up **rsyncd**, the dedicated rsync service. | |
| |
| First, install Cygwin with rsync and anything else you might like. | |
| |
| Second, set up rsyncd as a service: | |
| |
| $ cygrunsrv --install "rsyncd" --path /usr/bin/rsync --args "--daemon --no-detach" --desc "Starts a rsync daemon for accepting incoming rsync connections" --disp "Rsync Daemon" --type auto | |
| |
| Third, set up ''/etc/rsyncd.conf'' file: | |
| |
| <file> | |
| uid = nobody | |
| gid = nobody | |
| use chroot = no | |
| max connections = 4 | |
| syslog facility = local5 | |
| pid file = /var/run/rsyncd.pid | |
| read only = true | |
| hosts allow = <BACKUP_SERVER_IP> | |
| | |
| [root] | |
| path = / | |
| auth users = <USERNAME> | |
| secrets file = /etc/rsyncd.secrets | |
| </file> | |
| |
| Populate the user list ''/etc/rsyncd.secrets'': | |
| |
| <file> | |
| <USERNAME>:<PASSWORD> | |
| </file> | |
| |
| Then, on the backup server, create a file ''/root/cron/<WINDOWS_HOST>-rsync-password'': | |
| |
| <file> | |
| <PASSWORD> | |
| </file> | |
| |
| Now you can add backup lines to your rsnapshot.conf as follows: | |
| |
| backup rsync://<USERNAME>@<WINDOWS_HOST>/root/<PATH> <WINDOWS_HOST>/ rsync_long_args=--password-file=/root/cron/<WINDOWS_HOST>-rsync-password --no-numeric-ids --delete --relative --delete-excluded | |
| |
| The <PATH> looks is a cygwin path, so it looks like "''/cygdrive/<DRIVE_LETTER>/<PATH>''" (e.g. "''/cygdrive/c/My Documents/''"). If you've changed the drive path to "''/''" as mentioned in [[Cygwin SSH Server for Windows]], then omit the "''/cygdrive''" part. | |
| |
| If you want to back up something like your Firefox profile that will have certain files locked, exclude those files. For example: | |
| |
| backup rsync://<USERNAME>@<WINDOWS_HOST>/root/c/Users/<USERNAME>/Application\ Data/Mozilla <WINDOWS_HOST>/ rsync_long_args=--password-file=/root/cron/<WINDOWS_HOST>-rsync-password --no-numeric-ids --delete --relative --delete-excluded --exclude cookies.sqlite-journal --exclude parent.lock --exclude places.sqlite-journal | |
| |