Jump to content

How to sync two directories?


Recommended Posts

I am trying to find an easy backup solution for my little home network. I have two computers that I use all the time -- 1 Mandrake Linux and 1 Windows 2000. I have samba shares on both computers.

 

What I am looking for is a way to sync the samba shares on both machines so that I can use the two directories as a kinda of mirrored backup. Each directory is about 40 gigs in size so I don't want to have to be doing this manualy all the time.

 

I know rsync is capable of doing this kind of thing, but I thought it was more of a download tool. Is it able to handle syncing directories across a network?

 

I am wanting to use Linux for all the syncing syncing/backup duties, so whatever I use must be able to check both the local and the networked directories, see which files have changed and which have been added and upload/download only the required files.

 

Any suggestions?

 

How do other people handle backing up their computers?

Link to comment
Share on other sites

Rsync is not just a d-load tool, its meant for doing exactly what your after, syncing directories. I use it for mirroring sites with our own d-load site. For instance.

rsync -auv --delete mirror@plf.zarb.org::plf/ /var/ftp/pub/PLF/

This will Archive, Update only, give a verbose output, and delete any files that do not exist on the "sending" side. Their are more complex arguments you can add such as:

rsync -auv --partial --delete --exclude '.*' ftp.sunet.se::pub/Linux/distributions/mandrake/iso/ /var/ftp/pub/Mandrake/stable

Check man rsync for the full list of options available to you. You can even sync between two directories on one computer.

Its a great tool, set it up as a cron job to run when ever you want, and your done.

Link to comment
Share on other sites

Thanks for the link ramfree, it looks really interesting.

 

I am also going to read up on rsync as well. The only problem with it that I am not sure if it can handle is the fact that I do not have a single directory that can be used as the reference directory. Changes can be made to either directory -- i.e. files added/deleted/and or changed -- and I am not sure if rsync can handle that.

Link to comment
Share on other sites

I am also going to read up on rsync as well. The only problem with it that I am not sure if it can handle is the fact that I do not have a single directory that can be used as the reference directory. Changes can be made to either directory -- i.e. files added/deleted/and or changed -- and I am not sure if rsync can handle that.

I use unison in a similar situation, though on a smaller scale (not 40 gigs!), to sync files between multiple machines. You can add/delete/modify files from any location, and unison handles this situation just fine, as long as the same file hasn't been changed in both locations since the last sync. In that case, you have to manually intervene or set up a rule defining that one location overrides conflicting updates in another location.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...