Home > Linux > Sync folders between linux servers using rsync

Sync folders between linux servers using rsync

January 12th, 2009

I have my netbook, and I have a server. Now I want to sync files between these machines in order to keep a backup of all the documents of my netbook on the server. I found a page which explains how to sync between two servers. With a little tweak I created the command which I needed in order to sync the two folders.

$ rsync -avrR --links --rsh=/usr/bin/ssh ~/Documents/ home.basvandijk.eu:

In this command Documents/ is the documents folder in my home dir, home.basvandijk.eu is the server containing a Documents folder as well which is used to sync to.

  • -a enables archive mode
  • -v enables verbose mode
  • -r means recursive
  • -R means use relative paths
  • –links means copy symlinks as symlinks
  • -rsh specifies which remote shell to use

Linux ,

  1. TvL
    January 14th, 2009 at 17:40 | #1

    Hello,

    Very nice! You don’t have to specify “-r” and “–links” since “-a” already includes that. Also ssh is the default protocol for rsync nowadays. If you’re on gigabit and want to go fast, it’s a good idea to run “rsync -avR -e ‘/usr/bin/ssh -c blowfish’ ~/Documents home.basvandijk.eu:”. Blowfish uses less cpu…

    Nice posts, more linux please :)

  2. Bas
    January 14th, 2009 at 18:29 | #2

    Thanks for your comment!

  1. No trackbacks yet.