07 Sep 2010
Support Center
»
Knowledgebase
»
How to make snapshot backups using rsnapshot
How to make snapshot backups using rsnapshot
Article
RsyncPlace.com supports rsnapshot which is a filesystem snapshot utility for making backups by using rsync and hardlinks.
rsnapshot runs on our backup servers and "pulls", instead of "push", files from a server.
A special thanks to our client, Chris Johnston, for contributing to finding out how to use a custom location for the configuration file.
Link:
http://chrisjohnston.org/2008/setting-up-rsnapshot-using-a-custom-location-for-the-config-file
You will be performing all these steps on your backup account.
Step 1:
Like any other automated backup methods, such as rsync, you need to setup ssh RSA keys. Follow this guide for full instructions:
http://support.rsyncpalace.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=4
# ssh-keygen -t rsa -N ''
# scp ~/.ssh/id_rsa.pub
root@sourceserver.example.com
:.ssh/authorized_keys2
# ssh
root@sourceserver.example.com
"cat .ssh/authorized_keys2 >> .ssh/authorized_keys"
Step 2:
Here comes the fun stuff. Time to configure rsnapshot!
Copy the template configuration file to your home directory.
# cp /usr/configs/rsnapshot.conf ~/rsnapshot.conf
Edit the configuration file.
# vi ~/rsnapshot.conf
Configuration rules
* rsnapshot config file requires tabs between elements. *SPACE won't work!*
* All directories require a trailing slash. /home/ is correct, but /home is wrong.
First, specify root directory to store all backups:
snapshot_root /home/username/rsnapshot/
You must separate snapshot_root and /home/username/rsnapshot/ by a tab, and not a space.
Afterwards, you will need to define backup intervals.
interval hourly 6
interval daily 7
interval weekly 4
In the example in the configuration file, we want to take a snapshot every four hours, or six times a day (these are the hourly intervals). In the second line, backups are taken once a day and will be stored for a week. In the third line/set, backups are taken 4 times a week.
Lastly, you will need to specify which directories you would like to backup every interval. You can see the examples and follow the syntax in the configuration file.
To backup /home/, /etc/ for example from sourceserver.example.com to a directory called backup inside your snapshot_root, enter:
backup root@sourceserver.example.com:/home/ backup/
backup root@sourceserver.example.com:/etc/ backup/
*Make sure you use TABS! and backslashes!*
After that, save your configuration file and run:
# rsnapshot -c ~/rsnapshot.conf configtest
This will check if your syntax is right. It should show:
Synax OK
Otherwise, go back and apply changes and try again.
Example of failed syntax:
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot -c /usr/configs/rsnapshot.conf configtest
----------------------------------------------------------------------------
ERROR: /usr/configs/rsnapshot.conf on line 120:
ERROR: backup
root@example.com
:/etc/ example.com/ exclude=mtab,exclude=core
ERROR: ---------------------------------------------------------------------
ERROR: Errors were found in /usr/configs/rsnapshot.conf,
ERROR: rsnapshot can not continue. If you think an entry looks right, make
ERROR: sure you don't have spaces where only tabs should be.
Step 3:
Edit cron for rsnapshot to run the backups corresponding with the interval values:
# crontab -e
0 */4 * * * /usr/bin/rsnapshot ~/rsnapshot/rsnapshot.conf hourly
30 10 * * * /usr/bin/rsnapshot ~/rsnapshot/rsnapshot.conf daily
0 20 * * 3 /usr/bin/rsnapshot ~/rsnapshot/rsnapshot.conf weekly
1st line: 6 backups a day (once every 4 hours, at 0h, 4h, 8h, 12h, 16h, 20h)
2nd line: 1 daily backup every day, at 10:30AM
3rd line: 1 weekly backup every week, at 10:00PM, on Thursday (4th day of week, starts at 0. 4-1=3)
Save and you're all set!
Contact support if you have any problems with anything in this tutorial.
Article Details
Article ID:
7
Created On:
05 Apr 2009 8:25 AM
This answer was helpful
This answer was not helpful
User Comments
Add a Comment
Sharing is good. If you have a comment about this entry, please feel free to share. The comments might be reviewed by our staff, and may require approval before being posted. Questions posted will not be answered. Please submit a Ticket for support requests.
Image Verification Required
Please enter the characters that appear to the right in the space provided. This is just to verify that you are a human.
Full Name:
E-mail Address: (optional)
Comment:
Back
Login
Username:
Password:
Remember Me:
Search
-- Entire Support Site --
Knowledgebase
Downloads
Troubleshooter
Article Options
Add Comment
Print Article
PDF Version
E-mail Article
Add to Favorites
Home
|
Knowledgebase
|
Troubleshooter
|
News
|
Downloads
Language:
English (U.S.)
Help Desk Software
Help Desk Software by Kayako eSupport v3.70.02