# tb-rsync-vss /

Filename Size Date modified Message
installer-32
installer-64
tb-rsync-vss
11.1 KB
6.1 KB
2.4 KB

# tb-rsync-vss

A Microsoft Windows executable that uses the Windows Volume Snapshot Service (VSS) to create a snapshot of a Windows drive that can then be accessed via rsync. Because a snapshot is taken, you can rsync a drive that's in use: you will be able to read all files (including ones that are open on the source drive). In addition the snapshot will show all of the files at a consistent point in time.

I primarily use this program as a wrapper around rsync, so that rsync can be called by dirvish. I routinely back up Windows boxes to Linux servers using tb-rsync-vss with cygwin rsync and sshd.

tb-rsync-vss was written by Eric V. Smith of True Blade Systems, Inc., and is released under the Apache License, Version 2.0.

tb-rsync-vss has been installed and tested on Windows 7 (64-bit) and Windows Server 2008 R2 (64-bit).

## Overview

tb-rsync-vss works in the following way:

• It is called with the identical parameters as rsync would be. This is a requirement in order for it to be a drop-in replacement for rsync. The parameters to tb-rsync-vss are "hidden" in the last rsync parameter, which is normally the path to back up. This "hiding" is described later.
• It creates a VSS snapshot of a local path, such as "c:\Users".
• It maps this snapshot to another Windows drive letter, such as "z:". The snapshot will exist for as long as tb-rsync-vss and whatever program it executes are running.
• It modifies its parameters to point to this mapped snapshot.
• It calls another executable, typically rsync.

Note that tb-rsync-vss is a normal Windows excutable. In particular, it does not use cygwin.dll.

## Compiling tb-rsync-vss

I've compiled this with Visual Studio 2010 using the include tb-rsync-vss.sln. This solution file allows you to compile either 32- or 64-bit versions of tb-rsync-vss. For 64-bit Windows, you must use the 64-bit version of tb-rsync-vss.

tb-rsync-vss requires the boost C++ libraries.

## Pre-compiled .msi files

Pre-compiled .msi files, both 32- and 64-bit, are available on the project's bitbucket.org home page. The default installation location for these installers is "<program files>\True Blade Systems". That location will be used in all examples in this document.

The Visual Studio solution file includes projects to build these .msi files.

## Using cygwin sshd

There was a long-standing problem using cygwin rsync over cygwin sshd. The problem would result in rsync hanging when backing up large numbers of files. Although I could not find any specific reference to this bug being fixed, I have been able to back up 75 GB in 55,000 files with no problems, using a recent cygwin (1.7.11-1). In the past, this has always caused rsync to hang. I consider this problem to be fixed.

In addition, there are issues with using public key authentication and Windows. The root of the problem is that you're asking Windows for certain permissions without ever having supplied a password. For more information on this issue, see this excellent page. I use the LSA solution (method 2). I have also used the stored encrypted password (method 3) successfully. In both cases, you will need to have the public keys set up for your account.

## Passing parameters to tb-rsync-vss

Because tb-rsync-vss is a drop-in replacement for rsync, it must take the same parameters as rsync does. This yields a challenge: how to pass parameters to tb-rsync-vss itself? My solution is to hide them in the final parameter to rsync: the path that rsync will back up. For example, if you really want to back up c:\Users, normall rsync in server mode might be called with these parameters (using cygdrive notation): "--server" "." "/cygdrive/c/Users". When using tb-rsync-vss, the last parameter becomes: ""/|tmp-drive=x|rsync=c:/opt/cygwin/bin/rsync.exe|cygpath=true|c:/Users/".

tb-rsync-vss reads that last parameter, extracts its information, and translates it to "/cygdrive/x/Users/".

The key-value parameters that tb-rsync-vss understands are:

• tmp-drive: A single letter. This is the temporary drive letter that the snapshot will be mapped to.
• rync: The non-cygdrive path to the cygwin rsync executable.
• cygpath: If present and true, then the final path passed to rsync will be in cygdrive format (/cygdrive/x/Users/), otherwise it will be in normal DOS format (x:/Users/).

## Example dirvish configuration

If you're using dirvish, here's a sample configuration file that will use tb-rsync-vss to run cygwin rsync. It assumes that cygwin is installed in c:\opt, adjust it for your particular configuation.

client: Administrator@windows-box.example.com
tree: "/|tmp-drive=x|rsync=c:/opt/cygwin/bin/rsync.exe|cygpath=true|c:/Users"
expire-default: +6 weeks