Windows Backup With Rsync and FreeNAS

Trackback or

Backups can be really frustrating for people. I would have to say that managing backups is probably the one thing that I detest the most about working in IT. It is a clunky, clumsy process that often does not present any problems until you need it. Because of these issues, many people do not back up their systems.

Unfortunately, this is one of those things about computers that you absolutely need to do, regardless of how difficult, annoying, and painful it may be. I have spent a lot of time looking at this issue and I have come up with what I think is one of the better ways to backup a system without relying on the end user to perform regular backups manually. Also, it can be centrally managed, regardless of whether or not the user’s system is running.

This solution uses rsync, a service that only copies the differences in files that it is backing up. That way, your 1.5 GB PST file that only adds a few KB each day does not have to copy the entire file each time you back up your system.

rsync.png

This article will show you how to install and configure rsync so that you can use it to backup your information to a FreeNAS server. (If you have not been following the FreeNAS articles, please go back and look at them if you need a quick refresher on FreeNAS.)

Installing Rsync on Windows

The easiest way to install rsync on Windows (in my experience) is to use DeltaCopy. DeltaCopy is a Windows port of rsync that enables you to run it as a Windows service. This means that your computer will beck up properly without having to be concerned about being logged in to the system.

There are two different ways that you can download and install DeltaCopy. The easiest way is to download the installer which then walks you through the installation. This is the method that we will use.

If you feel that you are up to the challenge, you can use the manual install version. This is probably a bit more difficult for the average user but it is definitely an option.

Once you have downloaded the installer package, extract the setup.exe file and double click it to begin the installation.

rsync001.png

Click Next> to continue.

rsync002.png

The next screen determine where DeltaCopy will install. You can use the default or change it to wherever you want. Click Next> when you finish.

rsync003.png

Click Install to install DeltaCopy. This may take a couple of minutes but when it is finished, you should see this:

rsync004.png

Click the Finish button to complete the installation and launch DeltaCopy for the first time.

Configuring the Rsync Service

If you left Launch the program checked, the DeltaCopy interface starts up automatically. If it does not, you can open it from the Start button.

rsync005.png

You need to now register DeltaCopy with Windows as a service. Do this by clicking on the Register Windows Service button.

rsync006.png

You will immediately be prompted for an account username and password for the service to use.

rsync007.png

At this point, you have a decision to make. You can enter an account name and password here and use this for the service. Unfortunately, this causes errors more times than not and you will probably have to go back and fix the problem later.

Rather, I suggest you do the following. Leave the username and password blank and click OK. Next, go to the computer’s services (right-click My Computer -> Manage -> Services and Applications -> Services)

rsync013.png

and then double-click on DeltaCopy Server.

rsync014.png

Click on the Log On tab.

rsync015.png

Change the Log on as: value from This account: to Local System account. Click OK to close the window. You can also close the services window at this time.

You are now ready to start the Rsync server. Simply click on the Start Server button on the DeltaCopy Server Console.

rsync016.png

Once the stoplight goes green, you are in business.

Setting Up A Virtual Directory

Now that the server is running, you are ready to configure the directory that you want to back up. this can be any directory you want or the entire drive (though I do not recommend it). Four our example, we are going to be backing up a dirctory called Downloads that sits on the desktop.

In the DeltaCopy Server Console, click on the Virtual Directories tab. In the Existing Directories column, click on to open the New Virtual Directory window.

rsync019.png

Type in the name you want to use for your virtual directory. Please note that this must be the same as the mount point share name in FreeNAS where you will be backing up the data. Click OK once you have entered the name.

rsync020.png

You should now see the new virtual directory in the DeltaCopy Server Console. Highlight the new virtual directory. In the Directory options under Path:, type in the full name of the folder that you want to back up. Alternately, you can click on the Browse button and navigate to the directory you want to back up.

If you would like, you can enter a comment. this is not required but it can help you to remember what the virtual directory does or contains.

Check off Read only. The way, FreeNAS cannot accidentally delete files from your system.

rsync021.png

Once you are done, click on Close in the DeltaCopy Server Console. You have now completed the Windows portion of the configuration. Next. we will configure the FreeNAS server to pull information from the Windows computer and back it up.

Configuring the FreeNAS Server

Start by pointing your web browser at your FreeNAS server and logging in to the WebUI. Click on the RSYNCD option under the Services menu.

Services Menu

This should display the rsync options available in FreeNAS.

rsync018.png

The first thing you need to do is click on the Client tab. Since the rsync server is running on Windows, we need to use the rsync client in FreeNAS.

rsync023.png

Next, enable the client by checking off Enable. This will then activate the rsync client options.

rsync024.png

There are three areas that you really need to be concerned with:

  1. Remote RSYNC Server - this is the DNS name or IP address of the Windows box that you want to back up. If you are going to use the IP address of the Windows box here, make sure that the IP address is either static or has a DHCP reservation set up for it so that it always received that same IP address. If you are going to use the DNS name, make sure that DNS is set up for the FreeNAS server and that the host name of the Windows box is in the DNS system.
  2. Shares to be synchronized - find the name of the share that is the same as the virtual directory name that you created on the Windows box in DeltaCopy and check this box. You can synchronize multiple shares by creating multiple virtual directories in DeltaCopy as long as they have a matching share name in FreeNAS.
  3. Synchronization Schedule - this indicates how frequently the data is backed up. This is a very flexible schedule. In our example, this is an extreme backup schedule which replicates the data every five minutes. A more reasonable schedule would be once a day.
  4. ONce you have completed your settings, click on the freenas42.png button to commit your changes to the system.

    You are now finished configuring your backup system! Once your schedule has completed one backup cycle, your Windows folder and your FreeNAS folder should contain the same information just like these two screen shots:
    rsync026.png

    rsync025.png

    Conclusion

    This “set it and forget it” solution is a great way to use some old equipment to back up your home data! And the fact that it will continue to run without having to remember to back up the system manually, it is great for the average home user.

Trackback link - http://www.dailycupoftech.com/windows-backup-with-rsync-and-freenas/trackback/
Tim Fehlman

45 Responses to “Windows Backup With Rsync and FreeNAS”

  1. Chris M Says:

    Hi, great article.

    Is there an extra step to doing this if i was wanting to run freenas as the rsync server. i can’t seem to make it work this way round.

    thanks,
    chris

  2. cybersix Says:

    Wow..thanks for the articles…full of info.:D

  3. Hervé Says:

    Lo,
    first excuse my poor english …
    I try to make an automatic backup of 2 directories on my computer to the freenas computer.

    When you say :”Please note that this must be the same as the mount point share name in FreeNAS where you will be backing up the data.”

    I have a problem with this, because on my freenas i have 2 hd , first one is for the freenas system, second one 320 GIG for sharing my data between computers … but i didnt reserve a partition to make backup.
    How can i now make a ‘mount’ with the same name ??? If it possible i would like to create on my large hd a directorie named BACKUP, and inside 2 others for my backup …
    Mounted those 2, then rsync them by your method…

    Possible ?
    Thanks !

  4. Tim Fehlman Says:

    As a follow up to this article, I wrote E-Mail Request: Windows to FreeNAS Rsync and E-Mail Request: RSYNCed Data Unavailable. I believe that these two posts can answer your questions.

    Tim

  5. Adam Says:

    Hey!
    I just wanted to put my 2 cents in.
    I currently have a FREENAS server running on a P3 1ghz, 512mb ram. Hardware Raid and 2 SATA 160gb drives.

    The Freenas server is running as a RSYNC server.
    I use DeltaCopy Client to connect to the Freenas server.
    It is very easy to set up the connection profile by entering the IP of the Freenas server and testing the connection.
    I back up 3 folders, My documents, Favorites and Desktop.
    Since I also backup the same 3 folders on another PC and there is only 1 Virtual directory on the freenas server, I use Junction Link majik.
    I create 3 unique folders on the c: root and link them to the 3 windows folders that I backup.
    I now add those unique linked folders to my DeltaCopy list and force a backup.
    This creates the folders and backs them up.
    Now I create the schedule I want DeltaCopy to follow.

    One thing I found on the scheduler.
    Make sure you use a password on your windows username. The scheduler requires this. I found the error message by viewing the “scheduled tasks” window in “system tools”.

    Everything is working great and is fairly straighforward.

    Does anyone see any caveats with this setup?
    THanks

  6. Bob Says:

    My turn for the 2 cents thing (cheaper, since mine are canadian!)

    I have files and directories in the Windows box whose names contain foreign characters, like these: “é à è ê ç” etc. There is no way DeltaCopy will swallow those directory names at all. Turns out I’m not the only one with that problem, and that it’s not related to DeltaCopy itself, but to cygwin’s rsync. I’ve tried from Windows-2-Windows, Windows-2-Linux and Windows-2-FreeNAS (FreeBSD), and results are the same every time.

    Oh well… back to my neanderthal method of backing up my data.. :-(

  7. Paul Norris Says:

    I tried FreeNas, and it is a quick way to setup a large number of functions at once. I was also stuck with the limitation of Freenas and a large drive with only one share. I investigated NASBackup which allowed redirection to subdirectories, but that program requires passwords on the server. That program also required the user name be the same as the share name for it to work with FreeNas. Lastly, there is no restore function in NasBackup. But it does have a different interface.

    I found the only way to set up the RSync server with multiple shares is to do it myself. IE load cent OS, load samba and rsync daemon.

    However, if you dont mind using a package meant for VOIP, the preload trixbox for the Asterisk server includes samba and the rsync module. You just have to define the two rsync config files (password and shares) and the samba config file. Lastly use webmin to automatically start the rsync dsemon or just put it in the startup file.

    I use deltacopy locally with diferent shares. I wish Delta copy had usernames and passwords built in so it could be used over the net.

    Paul

  8. Dave Says:

    Great article.

    After I got my brain on junction points for backing up multiple directories (see E-mail Request: Windows to FreeNAS Rsync) everything clicked and it works like a charm.

    Nice website. Keep up the good work!

  9. Orla Says:

    Hi
    i found your article very good, i am new to freenas. I am trying to backup a folder on my pc to the freenas machine. I have deltacopy server running, virtual directory set up on pc and enabled client rsyncd on freenas.My freenas machine contain 3 drives, 1 has freenas install, other two 80gb’s are combined using raid 0 to look like 1 drive.The sharename of my drives is RaidIP31 and this is what i called the virtual directory on windows machine.any suggestions as to what im doing wrong. any suggestions greatly appreciated.

  10. Andreas Says:

    I tried this for the first time and i´m really happy with it.
    first it did not work, because i forgot to configure my windows firewall (open port 873).

    only negative thing is that you can´t specify a destination folder where to save the backup files.

  11. Mike Young Says:

    FOr hos eof you having problems with characters etc. try iFolder. Sweeet. I know this is rsync thread but that may help you

  12. Lei, Song Says:

    Hi:
    May I know how to add password for folders in Freenas server? I checked some website, but they said there is no function like that in freenas, help me please!
    Regards
    Lei, Song

  13. Dave Simmons Says:

    Hi,
    I hope it’s not too stupid a question, but which way should the backup be going in this example?

    I want to back up FROM Windows to FreeNAS, but using the setup described in this artcile, nothing seems to happen. If I set up Deltacopy client on the Windows machine to sync to the rsync server on the FreeNAS, then it works.

    I prefer the setup which you describe because it’s easier to configure very frequent syncs using the rsync client in FreeNAS.

    Anyway, thanks for the article - I’ve learned a lot, and it has helped me to set up a backup.

    Dave

  14. Chas D Says:

    I am running DeltaCopy on a windows XP pro machine. I am running both client and server. Everything works fine when I copy to an attached usb drive.

    But I am having a problem copying to a mapped shared drive on another computer. The error in the event log when I try to copy to a drive mapped to Z:\ is:

    The following information is part of the application event log: rsyncd: PID 4380: rsync: chdir /cygdrive/z failed
    : No such file or directory (2).

    Can anyone help on this issue? Is this a problem with running the client and server
    on the same machine?

    Thanks to anyone who can help.

  15. NeilP Says:

    If you are trying to get this to work to backup FROM the Windows machine TO the FreeNAS box you need to set it up the other way around.

    Client running and scheduled on the Windows machine, RSYNCD server running on the FreeNAS box.

    I eventually worked it out myself, not understanding what the other posts were telling me. Now i have got it to work, the other posts make more sense.

    Hope my post here helps someone

  16. Mark Says:

    Chas D or Anyone

    I’m running into the same situation. I can backup from a local drive where the DeltaCopy client is installed but when I schedule a backup for files on a shared drive it fails and the error message is as follows:

    **************Error Log***************

    Profile dd failed to execute.

    Execution log
    ————-
    building file list … rsync: link_stat “/cygdrive/O/dd/testdd.rtf” failed: No
    such file or directory (2)
    done

    ***************************

    I would appreciate any help on this issue.

    Thanks

  17. James de Castro Says:

    Hi there - great article.
    I am having the very problems you warn against in page 2 - I naively clicked on “Register Windows Service” and entered a username and password, and the service won’t start, and I am having problems setting it back to blank. How do I get back to the “fresh installation” state where that button pops up again?
    I tried uninstalling it but even after uninstalling and reinstalling it seems to “remember” that it was once installed and the “Register Windows Service” button does not come back…

  18. Mike Feingold Says:

    Thanks for great article. Just trying to get my head around it.

    I want to backup the 2 fileservers based at my office to a pc based at my home and I’m looking into using DeltaCopy to do this.
    All machines are Windows based.

    I think that the home machine (which will be a dedicated machine with lots of disk space) will need to run DeltaCopy server as a Windows Service. (I’m not using freenas).

    The 2 machines at my office that I wish to backup are Windows Server 2003. I think that these need to run DeltaCopy client.
    Will DeltaCopy run ok on this?
    These machines are servers so they’re not generally logged in on the console – will DeltaCopy work ok in this situation, running on a schedule?

    I want the backup machine to be a copy of whats on the servers, so if I delete a file from the server it should be deleted from the backup.
    Does DeltaCopy do this?

    Sorry for all the questions.
    Hope you can help!

    Regards,
    Mike Feingold

  19. C Provias Says:

    Hi,

    Will freeNAS act as server and client. I want to use freeNAs as the fileserver and backup my videos and other media on freeNAS as well. I do not want to have any media on my main PC. So what I am asking is if say I have 2 500 GB hard drives in my freeNAS machine can one be a backup of the other and automated with rsync as if it was on 2 different boxes.

    Thanks in advance,

    C. Provias

  20. Dave Simmons Says:

    FreeNAS offers various alternative methods of syncing data across discs - depends on which version you’re using - see UNISON for example. Why don’t you just use software raid if they are two identical discs?

  21. C Provias Says:

    Well, actually I mis-quoted myself. I have 2 X 250 GB drives and am going to add a 500 GB to double my capacity. So I could have a software raid of the 2X 250 to make a 500 GB drive but how does that then work. I am RAID stupid ;)

    Kryspy

  22. Neil Paisnel Says:

    Could you make your first RAID array, mirrored to the new 500Gig drive. Effectively an array (your first) within an array.

    so if your first array is RAID 0, you then create a second RAID array as RAID 1.

    The first part of the new array is your original array, the second part your new drive.

    This is all from theory, as I have not done it myself and do not have a working FreeNAS box at present. Try asking on the FreeNAS sourceforge help forum.
    https://sourceforge.net/forum/forum.php?forum_id=507590

  23. Neil P Says:

    Further answer.
    Yes you can have two seperate drives in FreeNAS and one can be RSYNC’d to the other In FreeNAS 0.69, and maybe earlier, there is a “LOCAL” tab on the RSYNC page. It allosw sync’ing of two drives within the FreeNAS box.

  24. ashton Says:

    I don’t understand why this page comes up first on a google search for rsync and freenas. Are there pages missing from this how to? All I can see is how to install deltacopy. I was hoping for more info about the freenas side. Any search I try ends up here or to other pages that link here. really frustrating.

  25. Alex Says:

    I´ve wasted my time with this, are you going to buy me a cup of coffee?

  26. Tim Fehlman Says:

    @Alex,

    Sorry it didn’t work out for you. I tried to send you a cup of coffee to your PayPal account but the e-mail address was rejected. I guess it didn’t work out for me either.

    Tim

  27. Ricardo Says:

    Kudos for the article. Unfortunately, I can’t read it past the installation part. What happened to the link to page 2?

  28. Endo Says:

    Me too … where’s the second page?

  29. Tim Fehlman Says:

    Sorry. all of the info should be here now.

    Tim

  30. Dharmesh Patel Says:

    Well, I was hoping to configure the server as my FreeNAS box and several Winblows PCs as clients who dump the backups to the FreeNAS box as it is hardware RAID 5. Is that possible and if yes, can you please publish that article? I thought this article was that but I guess not.

    Thanks for the detailed article though.

  31. GaryS Says:

    Great tutorial on incremental backups and perfect for syncing mobile laptops! Thanks! Now can you tell me how to set up RESTORE in case my laptop hard drive takes a dump? At present I have Raid 1 set up with complete backup of my Documents and Settings folder, so you would think I would be good to go in the event of a crash, but I have no idea how I would restore those files to a new hard drive.

    I’m using RSYNC and Delta copy as you describe in the tutorial, and also using RSYNC to back up the Raid 1 drive on the server to a USB external drive. Using XP on the clients, and using Freenas version 0.69RC1 Salusa Secundus (revision 3991)
    built on Fri Nov 7 22:54:14 UTC 2008

    Thanks again for a great tutorial.d

    Gary

  32. josef Says:

    Thanks for this great tutorial.

    It works some weeks but now I got a problem.
    If a make a rsync the perms were set to: drwx——-,
    so I can’t open the files. Before it was drwxr-xr-x and evrything
    was ok. What and where is the problem?

    best regards
    josef

  33. Hawaiitux Says:

    The easy fix for the permission mess I found is to simply add a cron job to perform a chmod on your share directory i.e. I run rsync at 0200 everyday and I run the chmod everyday at 0600.
    example:
    chmod -R 777 /mnt/share

  34. josef Says:

    thanks a lot, got it!

  35. gimpe Says:

    To Bob February 18th (I know your post is one year old)

    To fix the accentuated characters issue, you can replace the “Cygwin1.dll” in the DeltaCopy directory by a UTF-8 compliant Cygwin dll (http://www.okisoft.co.jp/esc/utf8-cygwin/). Restart the service or reboot and enjoy!

  36. Daniel Says:

    Hi
    Can you help me with setting up FreeNas to write itself (backup) to an XP machine.

    in other words backup the Freenas to xp.

    thanx

    Daniel

  37. Hawaiitux Says:

    Daniel,
    I’m not sure what you mean…you can easily save the “settings” to windows or what ever external media you might have. If you want to save the freenas “backup data” to a windows box you will have to expand on your question as this would defeat the purpose of freenas.

  38. Philippe Says:

    Hi all,

    I want to setup a synchronization process between several PCs and a freenas server.

    Every PC has a directory named ‘dir’ and can update a file in this directory. Once the file is uploaded to freenas, it must be sync’d to other PCs.

    I tried to figure out how I could do this, but I definitely need help on this.

    Thanks for any help or advice.
    Philippe

  39. Egor Says:

    Hello!
    I’m a little confused after reading this article. DeltaCopy help says:
    When you run a task in DeltaCopy, files are copied from the client machine to the server machine. But the algorithm above makes a backup in the opposite way: from server to client.
    In my case I have a Windows server on a local network with a directory that should be synced manually by user with their notebooks on-demand. First I thought that DeltaCopy is exactly what I want and notebook user could synchronize directory running tasks with their DeltaCopy Client. But when I tuned both server and client I was really amazed found my notebook files on server. Is there a way to rsync directory from real Windows server to notebook’ clients?

  40. Rob Says:

    xelnt tutorial very informative and clear straight to the point thanks!!!!

  41. josef Says:

    Hello!

    can anyone help? RSync works some months but now I got this

    @ERROR: chdir failed
    rsync error: error starting client-server protocol (code 5) at main.c

    Where is the problem?

  42. michael j Says:

    Great article.
    I’m looking applying this situation in reverse. I use one of my linux servers for rtorrent, and I want my HTPC to sync down all my downloads.

    Thanks for the article.

  43. Steve Collie Says:

    Easier than setting up a separate cron job to reset the permissions after rsync, you can add the following under Services|Rsync|Server|Settings:
    incoming chmod = ug=rw,Dug+rwx

  44. Jonathon Says:

    Hi there, I also want a reverse backup.
    E.g. I have the Freenas server which:

    Share1 directly stores movies and music. (not held anywhere else)

    Share2 (separate drive) acts as a backup area by which rsync backs up all data from my win2k3 dc. (user profiles and data).

    I want to backup share1 containing my movies to another pc on the network which has a 1tb hard drive.

    How can i do this!?

    Thanks

  45. Graeme Says:

    Hello

    Rsync is now updated to 3.0.7. and the configuration on Freenas is now a little different to the tutorial here, for example it is asking for ‘Remote Module Name’??? and I cannot find any meangful help with this.

    But thanks for article

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>