What backup solution you use for linux servers [closed]

Solution 1:

I use the openSource bacula. It is excellent - server/client model that works on windows or linux. There is good online support, and an active developer community.

A bit tricky to set up, but has all the features you could ever want.

There is also a nice web gui called bweb that can be used for day-to-day operation of it.

Solution 2:

As far as essential features go, you need to use the right tool for the job.

If your data set is small and fits on a single volume, use rsnapshot or rdiff-backup. Both offer incremental backup, are very space efficient, and are really easy to use.

For larger or more sophisticated backups that have an offline component I use Bacula, it takes a while to setup properly, but it's rock solid and has quite a few features. I recommend coupling it with a web interface like webacula.

One good idea btw, for every server I have I use rdiff-backup to keep a daily incremental backup of /etc in /var/backups/, it costs you nothing and will save you a lot of headaches if you can't figure out why that last change to a config file is causing so much havoc.

Solution 3:

I use rsync, both over the network from my colo to my home, and from my home box to a removable USB drive that I swap out for one I keep in my desk at work. The script looks kind of like this:

#!/bin/sh
STARTTIME=$(date +%s)
HOUR=$(date +%H)
DOW=$(date +%a)
WEEKNUM=$(($(date +%W|sed 's/^0\?//') % 4))
LOG=/tmp/last_hour.log
echo "" > $LOG

for DEST in /media/usb[0-9] ; do
  if [ -d $DEST/allhats2 ] ; then
    echo backing up to $DEST >> $LOG
    YESTERDAY=`cat $DEST/yesterday`
    LASTHOUR=`cat $DEST/last_hour`
    PREV=$DEST/allhats2/hour$LASTHOUR
    if [ ! -d $PREV ] ; then
      echo could not find a directory at $PREV >> $LOG
      PREV=$DEST/allhats2/$YESTERDAY
      if [ ! -d $PREV ] ; then
        echo could not find a directory at $PREV >> $LOG
        PREV=$DEST/allhats2/Sat/
      fi
    fi
    if [ $HOUR = "00" ] ; then
      if [ $DOW = "Mon" ] ; then
        echo moving last monday to week$WEEKNUM
        rm -rf $DEST/allhats2/week$WEEKNUM
        mv $DEST/allhats2/Mon $DEST/allhats2/week$WEEKNUM
      fi
      echo moving last midnight to $YESTERDAY
      rm -rf $DEST/allhats2/$YESTERDAY
      mv $DEST/allhats2/hour$HOUR $DEST/allhats2/$YESTERDAY
      echo $DOW > $DEST/yesterday
    fi
    echo about to backup allhats2 to  hour $HOUR >> $LOG
    rm -rf $DEST/allhats2/hour$HOUR/
    rsync -aSuvrx --delete / /boot /home /usr /var /backup_2/dbs --link-dest=$PREV/ $DEST/allhats2/hour$HOUR/ >> $LOG
    echo $HOUR > $DEST/last_hour
  fi
done

YESTERDAY=`cat /root/yesterday`
if [ $HOUR = "01" ] ; then
  # Backup xen1
  echo about to backup xen1 to /1u_backup/xen1/$DOW/
  rm -rf /1u_backup/xen1/$DOW/
  rsync -aSuvrx --delete -e ssh --exclude /var/spool/news/ root@xen1:/ --link-dest=/1u_backup/xen1/$YESTERDAY/ /1u_backup/xen1/$DOW/

  for DEST in /media/usb[0-9] ; do
          if [ -d $DEST/xen1 ] ; then
                  echo "backing up the backup"
                  rm -rf $DEST/xen1/$DOW/
                  rsync -aSuvrx --delete /1u_backup/xen1/$DOW/ --link-dest=$DEST/xen1/$YESTERDAY/ $DEST/xen1/$DOW/ 
          fi
  done

  # Backup xen
  echo about to backup xen to /1u_backup/xen/$DOW/
  rm -rf /1u_backup/xen/$DOW/
  rsync -aSuvrx --delete -e ssh root@xen:/ --link-dest=/1u_backup/xen/$YESTERDAY/ /1u_backup/xen/$DOW/

  for DEST in /media/usb[0-9] ; do
          if [ -d $DEST/xen ] ; then
                  echo "backing up the backup"
                  rm -rf $DEST/xen/$DOW/
                  rsync -aSuvrx --delete /1u_backup/xen/$DOW/ --link-dest=$DEST/xen/$YESTERDAY/ $DEST/xen/$DOW/ 
          fi
  done

  echo done

  echo $DOW > /root/yesterday
fi