A few days ago I was confronted with the problem to automatically backup some data directories once a day. I was looking for a free solution, but all I found where solutions that do a full backup every time. That would be very space consuming, so I was looking for a solution that can do incremental backups.

But there was nothing for Windows with support for incremental backups AND without paying a fee. I know there are many commercial solutions, but generally they are hard to afford for a small company. After a few commercial windows solution I looked deeper into some Linux solutions and finally got to rsnapshot.

rsnapshot uses rsync to synchronize with the remote directories. It also supports incremental backups by using the well known hard links of the linux universe.

The backup process works as follows (assuming there already exists at least one backup):

  1. The last backup folder is copied with hard link option. So every file in the folder is just a hard link, this consumes minimal disc space.
  2. The new folder is rsynced with the remote folder. Changed files get overridden (the hard link gets deleted, but the file still exists in the old backup folders)

This seems like a perfect solution, but not for windows. There exists a port to Cygwin, but then the hard links would be created on an NTFS partition (yes ntfs supports hard links) but they have a different behaviour when copying or deleting those files, so i decided to use a Linux backup box with ext2.

But how to sync from Windows to Linux? Just install rsync server on the Windows box (cwrsync) and share the data folders.

So my current backup solution looks as follows:

  • Windows server box with cwrsync server running(see cwrsync_conf.txt)
  • VMWare Server 2 on Windows Server with minimal Debian System (backup box).
  • NAS attached to backup box 
  • rsnapshot run by cron daemon every evening (see rsnapshot_conf.txt for relevant parts)

The relevant lines in crontab look as follows:

00 21   * * *   root    rsnapshot daily
00 3    * * 1   root    rsnapshot weekly

If you have further questions, leave me a comment.

推荐.NET配套的通用数据层ORM框架:CYQ.Data 通用数据层框架
新浪微博粉丝精灵,刷粉丝、刷评论、刷转发、企业商家微博营销必备工具"