Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to backup /home/* /root/* and mysql databases to a set of RAIDed drives.

Performance wise I want to do incremental backups.

Would this be the idea?

rsync -al /home /dev/sdb/backups/home

Tricky part. You would have to do a rotate and mysql dump per DB right?

share|improve this question
1  
Look into rsnapshot.org –  SvW Nov 2 '12 at 17:55
add comment

1 Answer

Here you go, this will make a nightly backup of home and a back dump of all your mysql data , it will copy the file in to a file named todays date. just mount the new disk and then name it some and adjust the script below , if you have a look at my blog i have the clean script and also one to email you if it hasn't worked.

 #!/bin/sh
 # Server Backup
 mkdir -p /storage/backups/`date +\%Y-\%m-\%d`-`date +\%A`/server/users
 rsync -avz /storage/backups/`date --date=yesterday +\%Y-\%m-\%d`-`date --date=yesterday +\%A`/server15/users/ /storage/backups/`date +\%Y-\%m-\%d`-`date +\%A`/server/users/
 rsync -avz --delete rsync -avz /home/ /storage/backups/`date +\%Y-\%m-\%d`-`date +\%A`/server/users/
 # Dump Mysql Data
 for database in $(mysql -u root -p(password) -e "show databases" | awk '{print $1}' | grep -v Database| grep -v information_schema | grep -v mysql | grep -v phpmyadmin)
 do
    mysqldump -u root -p(password) $database > /storage/backups/`date +\%Y-\%m-\%d`-`date +\%A`/server/$database.sql
 done
share|improve this answer
    
also have a look at my answer for this question serverfault.com/questions/420923/… –  Paperghost Nov 4 '12 at 11:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.