Using BackupPC with Windows Server 2008 R2

The idea is to be able to backup all files, including open files ("locked"), by using VSS (Volume Shadow Copy Service).
Here is a diagram, to have a better idea of how it is going to work:

Configuring Cygwin and access from the BackupPC server

Follow these steps:
  • Add the domain user called "backuppc", using the Computer Management program in Control Panel, Administrative Tools. Make this user administrator of the local machine.
  • Download Cygwin 1.7+ from the regular place:
  • Install the default Cygwin system, plus the following: cygrunsrv, openssh, and rsync
  • I also install nano (my editor of choice), and procps (for top)
  • Cygwin 1.7 changes the way to ignore NT Security from the nontsec environment to modifying fstab file.
    In your prefered editor modify /etc/fstab and uncomment the bottom line and add noaclas below, this tells it to ignore security:
        none /cygdrive cygdrive binary,noacl,posix=0,user 0 0
  • Start a cygwin shell and type:
        ssh-host-config -y
        cygrunsrv -S sshd
        mkpasswd -l -u backuppc -d DomainName >> /etc/passwd
  • I then attempt to ssh into my backupPC system from cygwin, just a nice test, and creates the .ssh directory for me.
  • Copy BackupPC’s public key over, by running this from the SRVR-UBackupPC server (this is just one line!):
    scp /var/lib/backuppc/ backuppc@servername:/home/backuppc/.ssh/authorized_keys
  • Test that you can log on without a password, from SRVR-UBackupPC server:
        ssh backuppc@servername
  • Copy all the files in BackupPC-Config.7z to the right places:
    • Logevent.exe to C:\Windows
    • DiskShadow.exe (the appropriate version, 32 or 64 bits, only in Windows 7) to C:\Windows
    • rsyncd.conf to C:\Cygwin\etc\rsync.conf
    • every other file to C:\Cygwin\BackupPC\ (all scripts, except instructions.txt and instructions.pdf)

Configuring the Windows 2008 server

Here is where it gets "complicated", though not really. We need to create an "Event log triggered scheduled task", and the Rsyncd service.
  • Edit the DiskShadow scripts: CreateShadows.txt, RemoveShadows.txt, so they create and remove Shadow snapshots for the drives that you are interested in backing up.
  • Edit the /etc/rsyncd.conf file to choose which folders to share. In our case, here is an example:
        path = /cygdrive/b/UserData
        comment = Courses
        auth users = backuppc
        secrets file = /etc/rsyncd.secrets
        hosts allow =
        strict modes = false
        read only = true
        list = false
  • Edit /etc/rsyncd.secrets, add at least one line, with this format:
  • Create the rsyncd service:
    C:\cygwin\bin\cygrunsrv.exe -I rsyncd -d "RSync Daemon" -O --type manual -p /bin/rsync.exe -f "Used by BackupPC to remotely access files for backup" -a " --config=/etc/rsyncd.conf --daemon --no-detach"
  • Then use Logevent.exe to create an "Event log":
        Logevent.exe -r "BackupPC" -e 10 -s S "Backup Start"
  • Now go to the Event Viewer. Select the new BackupPC event and choose Attach Task to this Event, and in the wizard click next until it asks for the program, then enter:
    NOTE: Make sure you select "Use SYSTEM account", and "Run with highest privileges".

Configuring the host settings in BackupPC

  • Log on to the BackupPC interface. Go to "Edit Config" for this host.
  • XFerMethod: rsyncd
  • RsyncShareName: in our example: UserData
    Add more as you need. Note: there is no "/" at the beginning!
  • RsyncdUserName and RsyncdPasswd: the same that you entered in /etc/rsyncd.secrets
  • DumpPreUserCmd:
        $sshPath -q -x -l backuppc $host cscript //B //NoLogo "C:\cygwin\BackupPC\pre-cmd.vbs"
  • DumpPostUserCmd:
        $sshPath -q -x -l backuppc $host echo "Complete: $xferOK" > /var/run/wake.up

And I think that's it!


  1. The rsync service as created here runs under the SYSTEM account. You need to make sure SYSTEM has write access to \var\run so the rsync daemon can create as set up in the config file rsyncd.conf.

  2. (at least on my system) The diskshadow script command "DELETE SHADOWS EXPOSED B:" bails out on an error when the B: mapping does not exist. The error is "Could not find the mount point." This stops diskshadow from completing its CreateShadows.txt script. There does not seem to be a way to make diskshadow ignore this error.

    1. I've now switched to using a much simpler method, without this whole hassle of Scheduled Tasks. It's here:
      Hope you can use it!


Post a Comment