LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   linux to linux backup (https://www.linuxquestions.org/questions/linux-newbie-8/linux-to-linux-backup-4175450098/)

linuxunix 02-14-2013 02:22 AM

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?

ted_chou12 02-14-2013 02:27 AM

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.

RaviTezu 02-14-2013 02:59 AM

Cron+rsync would be a better option.
Check the usage of rsync command & run it as a cron.

RaviTezu 02-14-2013 03:45 AM

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)

linosaurusroot 02-14-2013 06:50 AM

Quote:

Originally Posted by ted_chou12 (Post 4891333)
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

lleb 02-14-2013 07:15 AM

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.

chrism01 02-14-2013 07:42 PM

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/


All times are GMT -5. The time now is 12:07 AM.