0

I have a Ubuntu Server 12.4 LTS with Samba Share and I would like to synchronize my all Folders in the shared folder to the Windows Server (Win2k8R2). So Far I have used Lucky Back up, Freesync and Unison but all failed with a error msg and not even copying the data to the windows server.

Any Idea How I can accomplish this?

1
  • how much data are we talking about, would dropbox work for you?
    – Sverre
    Jul 30, 2014 at 7:25

1 Answer 1

1

You can mount your destination folder from your windows system as a drive in the Ubuntu system and use rsync to achieve your goal:

rsync -rtv source_folder/ destination_folder/

In the source_folder notice that I added a slash at the end, doing this prevents a new folder from being created, if we don't add the slash, a new folder named as the source folder will be created in the destination folder. So, if you want to copy the contents of a folder called Pictures into an existent folder which is also called Pictures but in a different location, you need to add the trailing slash, otherwise, a folder called Pictures is created inside the Pictures folder that we specify as destination.

The parameter -r means recursive, this is, it will copy the contents of the source folder, as well as the contents of every folder inside it.

The parameter -t makes rsync preserve the modification times of the files that it copies from the source folder.

The parameter -v means verbose, this parameter will print information about the execution of the command, such as the files that are successfully transferred, so we can use this as a way to keep track of the progress of rsync.

This are the parameters that I frequently use, as I am usually backing up personal files and this doesn't contain things such as symlinks, but another very useful parameter to use rsync with is the parameter -a.

rsync -av source/ destination/

The parameter -a also makes the copy recursive and preserve the modification times, but additionally it copies the symlinks that it encounters as symlinks, preserve the permissions, preserve the owner and group information, and preserve device and special files. This is useful if you are copying the entire home folder of a user, or if you are copying system folders somewhere else.

8
  • @ltai Ganot. Thank you so much for the well explained tut above. I will check this out and let you know what happened! Cheers Jul 30, 2014 at 7:24
  • @ltai, well the command worked with the same error which is rsync:failed to set times on /Test/Myfiles on xx/meda : operation not permitted (1) when I run the command with out the t it does not over right the file in the destination folder but creates another file with the same name.... any idea? Jul 30, 2014 at 9:20
  • Operation not permitted is often associated with Permission problems, can you check you have the right permissions to write at the destination folder?
    – Itai Ganot
    Jul 30, 2014 at 9:22
  • 1
    Add this to the command: --omit-dir-times. Your command should now look like this: rsync -rtv --omit-dir-times source_folder/ destination_folder/ Please let me know how it works for you.
    – Itai Ganot
    Jul 30, 2014 at 9:25
  • 1
    Check here: computerhope.com/unix/rsync.htm
    – Itai Ganot
    Jul 30, 2014 at 10:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .