Using rsync to update a samba share from windows

I have used this technique to migrate a windows fileserver to a ubuntu samba server.  Rsync is a brilliant tool that uses a delta-algorithm to transfer files. This makes it easy to keep folders synchronized across networks.

First I mounted the the windows share on my linux box using this command. Note the iocharset and codepage. These are to keep my Norwegian characters normal :)

mount -t cifs  //winserv/share /mount_dir -o username=johndoe,password=blabla,iocharset=utf8,codepage=cp850

Then, I used rsync to copy them into the new folders. Note the exclude, this is because /exports is a NetApp file system mounted via NFS, and I don’t want to include these backup dir’s into them mess.

rsync --verbose  --progress --stats --recursive --times --perms --links --delete --exclude '.snapshot' /source_dir /dest_dir

Voila!

Ps. Add the option –dry-run to have  a preview of what’s to come.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">