Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Intelligent backup?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
_Razorblade_
n00b
n00b


Joined: 01 Jan 2004
Posts: 30

PostPosted: Thu Jan 01, 2004 3:13 pm    Post subject: Intelligent backup? Reply with quote

I browsed thorugh backup/restore related postings but didnt find anything helpful yet...

My situation is that I have a two remote servers with Gentoo without physical access and limited (expensive) bandwidth.
Due to the lack of physical access CD-R(W) or tapes are no option, full or even incremental backups could be to expensive.

The server to backup is a mail/web/sql server with potentially ~2GB of important data.

Another fact: If the server dies I cannot rely on getting the same hardware again, so my compiled binaries would be useless.

My idea would be a combination of:
- Backup up userdata (IMAP-folders, home-dirs, MySQL dumps+ ???) and settings (/etc + ???) full each (month/week) with daily incrementals
- save system specific data (list emerged ebuilds + current kernel config + ???) to be able to actually *rebuild* the complete system on a different machine
- have some binary data (running kernel + modules + ???) backed up anyway just in case I'm lucky and get compatible hardware (to save time)


I'm sure I missed a lot, so it would be great to get some help where I put question marks as well as some ideas for backup programs I could use (using scp for transfer to the other server).


Thanks and best regards!
Back to top
View user's profile Send private message
BackSeat
Apprentice
Apprentice


Joined: 12 Apr 2002
Posts: 242
Location: Reading, UK

PostPosted: Thu Jan 01, 2004 8:30 pm    Post subject: Reply with quote

For backups, take a look at rdiff-backup.

BS
Back to top
View user's profile Send private message
ilikejonessoda
n00b
n00b


Joined: 23 Jul 2002
Posts: 15

PostPosted: Tue Jan 06, 2004 6:52 am    Post subject: Reply with quote

rdiff-backup is sweet.. I use it to backup all of my internal/external servers. I hacked a quick little bash script that will generate a folder named based on the current week, so at the beginning of every week it does a full backup then from that day until the next week will be an incremental backup
Back to top
View user's profile Send private message
mal0
n00b
n00b


Joined: 24 Nov 2003
Posts: 19

PostPosted: Fri Jan 09, 2004 12:43 pm    Post subject: Reply with quote

would be nice if you could post your script :D
Back to top
View user's profile Send private message
ilikejonessoda
n00b
n00b


Joined: 23 Jul 2002
Posts: 15

PostPosted: Wed Jan 28, 2004 8:37 am    Post subject: Reply with quote

I use it from cron as such
Code:

/usr/local/bin/backup /srv/smb/development/cvsroot /srv/backup/development/ /cvsroot


/usr/local/bin/backup
Code:

#!/bin/sh

function showUsage ()
{
        echo "Usage: $0 source destination_prefix destination_suffix"
        exit 1
}

# Setup Group Owner
GROUP_OWNER="Backup Operators"

# Test for valid parameters
if [ -z "$1" ]
then
        showUsage
elif [ -z "$2" ]
then
        showUsage
elif [ -z "$3" ]
then
        showUsage
fi


FOLDER=`/usr/local/bin/backup_folder_name`
DEST_DIR="$2$FOLDER$3"

# Check to ensure the destination directory exists
if [ ! -d "$DEST_DIR" ]
then
        mkdir -p $DEST_DIR
        chown -R ."$GROUP_OWNER" "$2$FOLDER"
fi

echo -e "[$1]"

rdiff-backup --print-statistics $1 $DEST_DIR
if [ $? -eq 0 ]
then
        chown -R ."$GROUP_OWNER" $DEST_DIR
        chmod 750 $DEST_DIR
fi


/usr/local/bin/backup_folder_name
Code:

#!/bin/sh
# This file is used for naming backup directories
# Uses `date` heavily

# Format for Week Start
WEEK_START="%Y%m%d.%A"

# Format for Week End
WEEK_END="$WEEK_START"

# Directory Separator
DIR_SEPARATOR="-"

# Get Today's Date
TODAY=`date +%D`

# Define Begin Date Variable
BEGIN_DATE="$TODAY"
# Define End Date Variable
END_DATE=""

function getBeginningOfWeek ()
{
        if [ -z "$1" ]
        then
                echo "Error: Invalid date $1 - getBeginningOfWeek ()"
                exit 1
        fi
        MNTH=`date -d "$1" +%m`
        DOW=`date -d "$1" +%w`
        YEAR=`date -d "$1" +%Y`
        # Substract the Day of the Week from the Day of Month
        DOM=$((`date -d "$1" +%e` - $DOW))
        # Check to see if we need to go back a month
        if [ $DOM -lt 0 ]
        then
                # Add the Negative Number to the last day of last month
                DOM=$((`date -d "$MNTH/0/$YEAR" +%e` + $DOM))
                # Subtract one from the month
                MNTH=$(($MNTH - 1))
        fi
        # Check to see if we ned to go back a year
        if [ $MNTH -lt 1 ]
        then
                # Set Month to 12 (December)
                MNTH="12"
                YEAR=$(($YEAR - 1))
        fi

        # Set Begin Date
        BEGIN_DATE=`date -d "$MNTH/$DOM/$YEAR" +%D`
        # Return success
        return 0
} # getBeginningOfWeek

function getEndingOfWeek ()
{
        # Check to see if we were passed something
        if [ -z "$1" ]
        then
                echo "Error: Invalid date $1 - getEndingOfWeek ()"
                return 1
        fi

        MNTH=`date -d "$1" +%m`
        DOW=`date -d "$1" +%w`
        YEAR=`date -d "$1" +%Y`

        # Get Day of Week Offset
        DOWO=$((6 - $DOW))
        # Get Day of Week for Saturday
        DOM=$((`date -d "$1" +%e` + $DOWO))

        # Set End Date
        END_DATE=`date -d "$MNTH/$DOM/$YEAR" +%D`
        # Return Success
        return 0
} # getEndingOfWeek

getBeginningOfWeek $TODAY
getEndingOfWeek $TODAY

# Construct Folder Name
FOLDER_NAME="`date -d "$BEGIN_DATE" +$WEEK_START`$DIR_SEPARATOR`date -d "$END_DATE" +$WEEK_END`"
echo "$FOLDER_NAME"


Sorry it took so long.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum