Backing up a server

Just curious what the easiest way you all know of is to "ghost" a server. I have all my files, etc backed up, but I was hoping I could create a one shot image of the installation, for worst case scenario moments. (Ubuntu running LAMP, not that it should matter terribly)

aberry@uoguelph.ca's picture

For an unmounted disk? dd is

For an unmounted disk? dd is reliable but very slow. Check out http://clonezilla.org/, it's quite fast and is very simple to use.

I personally use rsync for my own servers. This way I get a daily backup without having to have an unmounted volume. If I have to reinstall, I can just install a base OS then rsync everything back.

I have the following in /etc/cron.daily on the destination:

#!/bin/bash

TODAY=`date +"%Y%m%d"`
YESTERDAY=`date -d "1 day ago" +"%Y%m%d"`

RSYNC="/usr/bin/sudo /usr/bin/rsync"
EXCLUDES="/etc/furball.excludes"
DESTINATION="/media/media/furball/$TODAY/"

rsync -z -e "ssh" \
--rsync-path="$RSYNC" \
--archive \
--exclude-from=$EXCLUDES \
--numeric-ids \
--link-dest=../$YESTERDAY rsync@chewtoy.furrypaws.ca:/ $DESTINATION

Where the rsync user on the server has sudo permissions to run rsync so it can read everything. I got the command line by running it with full sudo permissions, then copying the command it ran so it could only do that (and not say, rm -rf /).

rsync ALL=(ALL) NOPASSWD: /usr/bin/rsync --server --sender -logDtprze.iLs --numeric-ids . /

/etc/furball.excludes contains:

/dev
/proc
/sys
/media
/mnt
/swapfile
/tmp
/var/tmp
/var/lib/mysql/

MySQL is backed up in a separate mysqldump script.

This has worked wonderfully in the years I've used it.

--
Andrew

Ol Reliable

As always, Drew, you're awesome.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.