Linux 101: How to Sync Two Folders on Two Hosts

This is a genuine request from a friend of mine who has a website and needs to be backed up in a hot stand-by server in case the production goes down. The command that I am using is ‘rsync’.

Firstly, you’ll have to install rsync on both boxes if you have not done so:

sudo yum install rsync

usually will do the trick

Secondly, I use the following command on the stand-by server to 'back up' all the PROD website's files:

sudo rsync -rtavue ssh /home/wwwroot/default/ --delete

The above command will ask your local password first and then your password on the PROD server. --delete gets rid of all files that no longer exist on the PROD side.

BTW, here is a better tutorial all about ‘rsync’.


About Nick Xu

Not a DBA anymore
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s