Sunday, March 15, 2015

Setting up Attic backup under Windows

UPDATE (2016-01-08): Per my research, by far the most cost effective hosting for online backups is offered by Time4VPS . If you are looking to set attic to back up offsite, that's the rock bottom price for what seems a very reasonably sized servers.

Out of all online backup tools, my favorite by far is Attic. It has some unique features, which are hard to come by:

  • Deduplication - every backup stores only fragments which were not already stored. It is extremely sweet for online backups. Not only fragments of non-changed files are not backed up, but also ANY fragments. Which means, files copied, folders renamed - no problem. You can store 100 copies of the same file, and it will only store it once. You can store live image of virtual machine, and it will only be stored once. Sweet.
  • Built-in SSH compatibility, which means: can backup over SSH to any server which has SSH access. In other words: here's a good use for VPS servers. With some shopping around, $10/month could get you half-terabyte storage.
  • Pre-Internet encryption: data could be encrypted before it goes out to storage. Thank you NSA for teaching us we need to not trust our own ISP.
  • Open source - not that anyone does it, but nevertheless - code is inspectable.
Those of us, who have not switched to Linux are of course deprived from this sweetness, so lets get that fixed now. Using following instructions, you can get attic running under windows.

Platform

Attic will be running from cygwin. There are are two modes you can run it in: 32 and 64-bit. It is possible to run attic in either, however I would strongly recommend 64-bit installation where possible.

Required Packages

You need at least following packages to be installed in order to be able to install attic:

  • python3
  • python3-setuptools
  • gcc-g++
  • curl
  • openssh
  • git
  • openssl-devel
Installing cygwin would take some time, so fire it up and grab coffee.

Installation

We will now install pip tool, compile necessary packages, download attic source code modified for cygwin compatibility from git, and install it

Pip and Cython tool

Install pip:
easy_install-3.2 pip
Then, you need to install Cython package:
$ pip install Cython

Get, compile and install Attic

Original Attic project was modified by CogPy to give it cygwin compatibility. The changes he introduced allowed using getfacl/setfacl tools in order to store ACLs. Unfortunately, this caused the tool to be very slow, because for every file it works on, there is a process spawned. I modified that project, removing that feature, so in its current incarnation, no ACLs are stored. The project code is currently kept in https://github.com/galets/attic .

$ cd /tmp
$ git clone https://github.com/galets/attic
$ cd attic 
$ git checkout win32
$ python3 setup.py install

Testing Installation 

Run following commands to test the installation:

$ attic init /tmp/test-repository
Initializing repository at "/tmp/test-repository"
Encryption NOT enabled.
Use the "--encryption=passphrase|keyfile" to enable encryption.
$ attic create /tmp/test-repository::first-backup /var
Initializing cache...
$ attic list /tmp/test-repository/
first-backup            Sun Mar 15 16:33:18 2015
That is it. You are ready to do your own off-site and on-site backups using attic on windows