One of the best tool that I know for incremental backups is Bup. I’m using this great project for all my backups with my Linux installation. But on the Windows side, it’s an other story. This post will explain how to deploy Bup and how to browse the snapshots with the file browser.
The first step is to install the Cygwin environment because Bup is written mainly for Unix OSes.
Download the Cygwin installer: setup-x86_64.exe
Follow the steps, then you should see this screen:
You must install the following packages: python (2.7), python-setuptools, git, make, rsync, gcc-core (4.x), perl, par2
Then you will have all the necessary tools in order to build and use Bup.
Open the Cygwin terminal and execute this script in the shell:
$ echo "export SHELLOPTS set -o igncr" >> ~/.bash_profile
It fixes a problem with the scripts where a
\r (carriage return) exists for
Bup wants tornado for it’s web server. Then you must install the package manager pip and then, tornado.
$ python -m ensurepip $ pip install tornado
The environment is installed, it’s the time to build Bup.
$ git clone https://github.com/bup/bup.git $ cd bup $ git checkout 0.27 $ make
Checkout the last release. Don’t use the
HEAD of master because it can be
unsafe for your backup.
$ make install DESTDIR=/opt/bup PREFIX='' $ export PATH=/opt/bup/bin:$PATH $ echo "export PATH=/opt/bup/bin:$PATH" >> ~/.bash_profile
If the build succeeds, you can install Bup in
/opt/bup and update the
PATH environment variable.
You can check if Bup is working with this simple command:
$ bup --version 0.27
The first step is to initialize a Bup repository. Note that Bup uses the same packfile format of Git. Then the repository is initialized like with Git.
Bup uses Git, but it improves the way how the big files are stored. Git is not efficient with binary files, then Bup split the files in smaller chunks with it’s own mechanism. But the repository is still readable with the common Git commands. The files just look different.
For my backups, I use a drive
z:, then I configure Bup in order to
initialize the repository on this drive.
$ export BUP_DIR=/cygdrive/z/bup $ echo "export BUP_DIR=/cygdrive/z/bup" >> ~/.bash_profile $ bup init
Very well, it’s time to backup something.
$ bup index /cygdrive/c/foobar $ bup save -n foobar /cygdrive/c/foobar $ bup fsck -g
The last step is very slow, at least for the first time. The parity uses ~10% of the backup size. It’s very important to do this step, it prevents corruptions like “bit rot”.
There are several ways in order to work with the Bup’s snapshots. Just read the manual for that. But an easy way is to use the web interface provided by Bup.
$ bup web Serving HTTP on 127.0.0.1:8080...
Yes, it’s the main problem on Windows. There is no easy way in order to have a file system in user space like the great Fuse on Linux. And of course, Bup supports Fuse. It’s the one of the main reasons why Bup is better on Linux.
Someone has done the work for adding webdav to the web server.
The first step is to install the Cygwin package python-lxml; then you must build a fork of Bup 0.27 which adds the webdav support.
$ git remote add webdav https://github.com/wrouesnel/bup.git $ git fetch webdav bup-web-improvements $ git checkout bup-web-improvements $ make $ make install DESTDIR=/opt/bup PREFIX='' $ bup web
Then now you can map a network drive to the following address:
Yes, it’s not perfect and it’s seems that this feature is a bit bugged because it’s not working fine with non-ascii 7 bits characters. This problem doesn’t exists with Fuse.
Please remember that the webdav support is not official. It’s at your own risk.