RimuHosting: Great Linux Servers.  UnMatched Support
Plans & Pricing
VPS Technology
Hardware
Data Centers
Linux Distributions
Applications
Web Sites
Plesk Reseller Hosting
Java Hosting
Email
Software Development
Server Monitoring
Redundant Server
Enhance Your Geekness
Maintenance Notices
Support Ticket
Control Panel
HOWTO Articles
Bliki (Blog + Wiki)
Forums
About
Staff
News
Customer Testimonials
Sales Inquiry
Link To Us
Terms and Conditions
--Support--
Maintenance Notices
Support Ticket
Control Panel
HOWTO Articles
Bliki (Blog + Wiki)
Forums

Order VPS Hosting
More VPS Hosting Plans
Dedicated Servers

Get Assistance
Ask our support team about your hosting requirements.

Thanks, you are a life-saver! I had weeks of work in there!! Thank you VERY much!! I would never use any other provider other than your company! I love the FAST service!!

- Jeffery after we restored a key directory for him from our backups. Please note customers should always keep their own copies of key files. (#262/265)

Host where the staff takes pride in making customers happy

Home > Support > HOWTO List > Linux > RSync

Working With Linux

Backups with RSync

RSync is a useful tool.  It facilitates directory replication across servers.   It will compare a source directory and a target directory and 'sync' them up.   It is implemented to run quickly and to use minimal bandwidth. 

The syntax goes something like this:


EXCLUDE=" --exclude *.tmp \
--exclude *.temp"

rsync --archive -vv --rsh=ssh $EXCLUDE $USER@$HOST:/etc/ $BACKUPPATH/$HOST/etc

This code will 'pull' a backup from a remote host (source) to the local machine (destination).   It will use SSH (-e ssh) so the remote machine does not have to be running an rsync daemon.  It will be very verbose (-vv).  It will ignore any files ending in tmp or temp.  Swap the last two args to 'push' a backup from the local machine to the remote machine. 

An example: rsync --archive -vv --rsh=ssh datadir yourbackupserver:/home/backups/

'Man' tells us that the '-archive' option is the same as '-rlptgoD' or:

There are many other options available.  e.g. --delete will delete any files on the receiving side that aren't on the sending side.  You'll probably want to tack on a --compress option for compression; and a --sparse option to efficiently handle sparse files and --stats --progress to show you something interesting while a big job runs.  --ignore-existing will leave existing files as is.

Idea: Put the rsync command in your crontab to perform regular backups. 

Idea: Keep multiple 'generations' of your site by using different destination directories (e.g. backups1, backups2).  If space is an issue, cycle through the directories every so many days or months.

Idea: Use 'ssh authorized keys' so backups can be performed via SSH without password prompting.  E.g. see: automated rsync backup howto.

Idea: Back up your PC to your Linux server.  Get an offsite backup of your Windows PC.  Grab the rsync application by doing a http://www.cygwin.com install.  Then 'push' a backup to your Linux VPS.