Skip to content

Backing up a Windows host with rsnapshot

After setting up this Windows box I thought I could skip HardlinkBackup this time and configure its backups with rsnapshot, my most favourite backup solution anyway:

  • Install an SSH Server for Windows. Copssh is no longer a free product but an older version was made available for our convenience. Note: using an stale version also means that no security updates will be available - probably not a good idea if the box is directly connected to an untrusted network. Download & install and SSH should be good to go. You may want to open a firewall port. After public key authentication has been set up, the sshd_config(5) could be tweaked a bit:

    +Protocol 2
    +PasswordAuthentication no
    +AllowAgentForwarding no
    +AllowTcpForwarding no
    +AllowUsers      Administrator
    Don't forget to restart the SSH service after adjusting the configuration: net stop "Openssh SSHD" (and then "start" again)

  • With rsnapshot to work, we'll need a Windows version of rsync, Cwrsync Again, this is no longer a free product but they also made an older version available. Neat. Download & install should be an easy clickfest. However, rsync.exe may not be in our PATH when logging in via SSH, so let's add a symlink:

    $ ln -s /cygdrive/c/Program\ Files/ICW/cwRsync/bin/rsync.exe /bin/rsync.exe
  • With all that in place only rsnapshot is left to be configured. Here's a (shortened) configuration file:

    snapshot_root   /mnt/backup/rsnapshot/windows/
    cmd_rsync       /usr/bin/rsync
    interval        daily   7
    interval        weekly  4
    interval        monthly 2
    verbose         2
    loglevel        3
    logfile /var/log/rsnapshot/rsnapshot-windows.log
    lockfile        /var/run/
    rsync_short_args -rlptDzv
    rsync_long_args  --delete --numeric-ids --delete-excluded --relative
    exclude_file     /etc/rsnapshot/rsnapshot-windows.exclude
    link_dest       1
    backup  Administrator@windows:/cygdrive/c/Documents?and?Settings/   windows/
    backup  Administrator@windows:/cygdrive/c/Program?Files/ICW/CopSSH/ windows/
    Note that I did not use the usual -a option for rsync because the windows ownerships (-go) could not be mapped to a Unix user and files would get transferred over and over again because of this. The same goes for ACLs (-A) and EAs (-X).

  • Happy recovering :-)