Till today, a lot of personal computers are still running Windows OS (XP, Visat, Seven, ...) and many people are still keeping a lot of valuable datas directly on their workstation or laptop hard disk. Most people do so because of ignorance of the risks or because they are always on the move and they need their files available anytime, even not connected to any server.
The side effect of this behaviour is that everything can be lost in case of a hard disk crash, as all the datas are stored locally on the PC.
So, to avoid that type of loss, it is very important to save all your personal valuable files on a secure server.
RSync may be the clue to this problem. In fact, RSync is widely used to do data backup in the Unix/Linux world and it is having a lot of advantages :
- it is multi-os (unix, linux, windows, ...)
- it is using differential backup mecanism (only modifications are sent across the network)
- it is command line base
- some GUI are available, even on Windows (DeltaCopy)
This article will explain how to provide a very simple and very efficient way to backup your Windows PC local files on a Debian server with the help of RSync and DeltaCopy.
It has been succesfully tested on Windows XP and Windows Seven clients and on Debian Squeeze server.
By following these steps, you will be able to save all your local datas from your Windows PC to your Debian server in a very optimised and lightning fast way. Whatever happens to your PC, your personnal data will be safe !
All the following commands suppose you are connected as root.
It you are not logged as root, make sure to add sudo for each and every command.
1. Debian Server
1.1. Install RSync
First thing to do is to install rsync on your debian server
# aptitude install rsync
1.2. Configure RSync backup policy
This article won't explain all the options available with RSync. You can get all needed help from http://rsync.samba.org/.
Here is an example of a minimal setup with one backup virtual directory declared.
RSync configuration is done thru /etc/rsyncd.conf.
# /etc/rsyncd.conf Configuration file for rsync.
max connections = 2
log file = /var/log/rsync.log
timeout = 300
comment = Backup files of a PC running Windows and DeltaCopy
path = /path/where/to/store/the/backup/on/the/debian/server
read only = no
list = yes
uid = 0
gid = 0
auth users = youruserid
secrets file = /etc/rsyncd.secrets
strict modes = yes
You can set the uid and gid to whatever existing user id and group id on your server. It can be either referenced by name or by id. Here 0 means root.
As you can see if that file, the login/password are saved in a separate file /etc/rsync.secrets. The file is having the following structure :
RSync will accept to use that file for secrets if it is accessible by root only. To do so, just throw the following command :
# chmod 0700 /etc/rsync.secrets
Once these steps are done, you just need to restart your RSync server to be able to start a differential data backup :
# /etc/init.d/rsync restart
2. Windows Client
2.1. DeltaCopy Installation
On your Windows workstation, you first need to install the latest version of DeltaCopy from http://www.deltacopy.com.
DeltaCopy is a OpenSource software using the Windows Cygwin libraries.
At the timeof this article, one of the main drawback of DeltaCopy is that it is embedding Cigwin v1.5, which is a quite outdated version having some very annoying limitations :
- it can't handle properly all Western Euporean caracters with accents (é, è, à, ä, î, ...)
- it doesn't handle file path with more than 256 caracters
Hopefully, latest version of Cygwin v1.7 is available and is getting rid of all these limitations.
2.2. Cygwin installation & DeltaCopy patch
Here is the procedure to patch DeltaCopy to use Cygwin 1.7 files. With this additionnal step, you won't get any problem to do backup of directories or files having accents and to do backup of file paths up to 4096 caracters.
On your Windows PC, you first need to install the latest version of Cygwin 1.7 from http://www.cygwin.com. Default installation will be done under c:\cigwin.
During installation, make sure you install the following optionnal packages :
- Net : RSync
- Net : OpenSSH
Once installation is over, you will need to copy all the cygwin files used by DeltaCopy from the cygwin installation directory (c:\cigwin\bin by default) to the DeltaCopy installation directory (c:\DeltaCopy by default) :
- All .dll files
If you don't get these files, it means that you haven't installed the optional packages.
Most of these files should replace the original ones provided by the DeltaCopy installation package.
Your DeltaCopy installation is now patched and ready to backup your files with latest Cygwin libraries !
2.3. DeltaCopy Configuration
You need to configure DeltaCopy to :
- connect to the Debian RSync server
- backup the needed directory structure
To do so, fill-up the parameters as follow :
You can add as many folders and files as you need. They should appear in the list like the red circle one.
If you plan to do backup only from your LAN, the Server Name can be the server IP address. But if you plan to do backup of your files being connected on the net away from home, you need to fill-up the fully qualified name of your server (myserver.dyndns.org for example).
You can get the list of available virtual directories declared on the server by clicking on the ... button.
These options are setup to do a mirroring of the directories to backup.
3. Router setup
This step is optionnal, it's only needed if you want to be able to backup your files from Internet, being on the move.
As you will start the backup from internet, you need to make sure that your home router will formard the RSync data to your Debian server.
To do so, you just need to setup some port forwarding of port 873, protocol TCP, to your debian server. The exact procedure depends on your router.
That's it !
You are now ready to do the first backup ...
Just select your profile, right click and select Run now ....
Your backup should start. As it is using some differential algorithm, first backup will take some time as it is a full backup, but next ones should be very fast !
Following the DeltaCopy manual, you can even do some backup planifications.
Your PC local files are now safe !
Hope it helps.