LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-14-2013, 03:22 AM   #1
linuxunix
Member
 
Registered: Mar 2010
Location: California
Distribution: Slackware
Posts: 235

Rep: Reputation: 18
linux to linux backup


I have Fedora , Ubuntu and CentOS machine which I need to configure for automated backup. Backup need both incremental and differential. How shall I achieve that?
Any resources, link?
 
Old 02-14-2013, 03:27 AM   #2
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 421
Blog Entries: 28

Rep: Reputation: 2
Here is my backup script just as an example:
Code:
image="/dev/sda1"
backup="/mnt/linux/vectordb/backup/sda1_backup.gz"

body="$(dd if=$image of=$backup 2>&1)"

echo "From: xxx@domain.com
To: xxx@domain.com
Subject: Server Backup Generated
##Logged in as $USER##
Hi, you have a new backup generated;
for the physical drive \"$image\";
generated image is at \"$backup\".
$body
This is an automated backup system timed weekly.
##Server Time $(date)##" | msmtp -t
Let the crontab call this script once a week or month. If you want ot save the backup to another machine, thats another story.
 
Old 02-14-2013, 03:59 AM   #3
RaviTezu
Member
 
Registered: Nov 2012
Location: India
Distribution: Fedora, CentOs, RHEL
Posts: 164

Rep: Reputation: 24
Cron+rsync would be a better option.
Check the usage of rsync command & run it as a cron.
 
1 members found this post helpful.
Old 02-14-2013, 04:45 AM   #4
RaviTezu
Member
 
Registered: Nov 2012
Location: India
Distribution: Fedora, CentOs, RHEL
Posts: 164

Rep: Reputation: 24
Something like this, should be used on the host:
Quote:
rync -azSP /path-of-files-for-which-you-need-backup Destination-host-name:/path-to-store-backups
You may use options like --delete-after --exclude etc.(Check their usage)

Make this command run as a cron. (Click here for cron tutorials)
 
Old 02-14-2013, 07:50 AM   #5
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 979
Blog Entries: 2

Rep: Reputation: 235Reputation: 235Reputation: 235
Quote:
Originally Posted by ted_chou12 View Post
body="$(dd if=$image of=$backup 2>&1)"
That's very crude. It copies empty space in sda1 and isn't a snapshot. It doesn't even gain efficiency by increasing the blocksize.

sensible ideas include:
dump/restore
logical volume snapshots
rsnapshot
 
Old 02-14-2013, 08:15 AM   #6
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
rsync is really the best way to go unless space is an issue, in that case you might want to consider tar and sending that across the LAN.

i typically do something like the following:

Code:
### Setting Variables
#####################################
dtstamp="`date +%F-%A-%H.%M.%S `"
dow=`date +%A`
HOMEDIR="$HOME"
PWD=`pwd`
log=${PWD}/logs/`date +%Y-%m-%d-%A`-rsync.log
RUSER=your_user_here
RHOST=either_IP_address_or_DNS_name
RDIR=/path/to/backup

### Checking for logs directory, if not there then create it
#####################################

[ ! -d "${PWD}/logs" ] && mkdir -p ${PWD}/logs >> /dev/null 2>&1

#rsync -aviS /www/ -e "ssh -p ${PORT}" ${RUSER}@${RHOST}:${RDIR}/${dow}/ >> ${log} 2>&1
rsync -aviS /www/ -e ssh ${RUSER}@${RHOST}:${RDIR}/${dow}/ >> ${log} 2>&1

### Clean up log directory to only keep 16 days woth of logs

find ${PWD}/logs/*.log -mtime +15 -exec rm '{}' \;

exit
now that script is designed to only backup specific directories, but it could be easily modified to backup an entire system. do remember that if you wish to make a full system backup that this script will need to be run as root, not as user.

this script keeps seven days worth of backups and is set to run via cron every 4hrs on my web server. it pushes the data from my web server to my NFS server at my house. my web server is located out of my city.
 
Old 02-14-2013, 08:42 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
For 3 boxes, home-built eg above is probably good enough.
You could have a look at this for comparison http://www.zmanda.com/quick-backup-setup.html & http://blogs.umass.edu/choogend/2007...-about-amanda/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux os backup like Ignite backup in HP-UX santosh.rathod Linux - Newbie 2 03-07-2012 09:56 AM
LXer: Rsync Backup for Windows, Linux Knoppix, and Other Smart Technologies in Handy Backup by Novos LXer Syndicated Linux News 0 12-24-2011 12:43 PM
[SOLVED] Linux HDD backup under windows - looking for backup utility SigTerm General 1 01-27-2010 12:54 PM
DISCUSSION: Using Linux to backup and recover Windows and Linux systems shshjun LinuxAnswers Discussion 3 12-05-2009 10:42 PM


All times are GMT -5. The time now is 04:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration