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

I currently back up my Fedora Linux server using rsync and a local USB drive. So far this seems to suit my needs, but I suspect there are better ways to go about this. Long ago I used to use tape, but tape backup of size to back up my server is now priced way out of my price range. Something automated would be better. Although I suppose I could automate my current rsync backup, this would mean leaving the USB drive on all the time.

Thoughts?

share

locked by HopelessN00b Dec 5 at 3:59

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as off topic by Zypher Jan 20 '12 at 17:55

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

7 Answers 7

The solution I use it to find a friend who doesn't mind hosting a small fanless server at their house. I then have an automated rsync script that runs over night to sync my data to a remote location.

share
    
I like this answer (and pjz's) because it emphasizes the importance of offsite backups. We do them at work, why not at home, too? +1 for both answers. –  Dennis Williamson May 1 '09 at 2:50
    
You don't even need a server, lots of NAS devices have the ability to SSH into. Which should cut down on power and noise costs. –  Adam Gibbins May 5 '09 at 8:41
    
I've had experience with this, and found that consumer NAS devices tend to have such low CPU power that SSH (encryption overhead) and rsync (hashing overhead) are prohibitively slow - 1 to 2 MB per second transfer, plus just reading files is slow even when nothing has changed. Unencrypted FTP was fine. This probably doesn't apply to newer Intel x86 based devices - mine was Marvell Orion based. –  thomasrutter May 6 '10 at 3:06

I backup my server with duplicity to amazon S3. I do a full backup every quarter and incrementals nightly. Works quite well.

share
    
I backup /home/osama and /etc this way, I have my full backup weekly. It costs peanuts. I do some other less-important with these backups to a usb harddisk using rsync (also nightly). –  Osama ALASSIRY May 7 '09 at 9:42
    
duplicity also support using gmail so it can cost nothing if your backup is less than the gmail limit. –  brunoqc Jun 2 '09 at 3:53

I use rsnapshot which uses rsync and does incremental/full backups really well.

I wrote a shell script that I run from a cron job to mount the disk, run rsnapshot, then umount the disk, so it is not mounted all the time.

Here are the scripts I use. The first is /usr/local/sbin/backup.sh, which basically is a wrapper around the script that does the real work, captures its output and exit status, and then emails the results to root:

#!/bin/sh
#
# Run the dobackup script, capturing the output and then mail it to the
# backup alias person with the right subject line.
#

BACKUP_TYPE=daily
if [ "a$1" != "a" ] ; then
  BACKUP_TYPE=$1
fi

/usr/local/sbin/dobackup.sh ${BACKUP_TYPE} < /dev/null > /tmp/backup.txt 2>&1
RET=$?

SUBJECT="${BACKUP_TYPE} backup for $(hostname) (ERRORS)"
if [ "a$RET" = "a0" ] ; then
  SUBJECT="${BACKUP_TYPE} backup for $(hostname) (successful)"
elif [ "a$RET" = "a2" ] ; then
  SUBJECT="${BACKUP_TYPE} backup for $(hostname) (WARNINGS)"
fi

mail -s "$SUBJECT" root < /tmp/backup.txt

exit $RET

And here is /usr/local/sbin/dobackup.sh, which is the real workhorse:

#!/bin/sh
#
# Perform the backup, returning the following return codes:
#
# 0 - backup successful
# 1 - errors
# 2 - backup successful, but with warnings.
#

if [ -e /dev/sdb1 ] ; then
  BACKUP_DEV=/dev/sdb1
else
  echo "No backup device available."
  echo "CANNOT CONTINUE WITH BACKUP."
  exit 1
fi

BACKUP_DIR=/mnt/backup
BACKUP_TYPE=daily

if [ "a$1" != "a" ] ; then
  BACKUP_TYPE=$1
fi

echo "Performing ${BACKUP_TYPE} backup."

umount $BACKUP_DEV 2> /dev/null
mount $BACKUP_DEV $BACKUP_DIR
if [ "a$?" != "a0" ] ; then
  echo "Error occurred trying to mount the external drive with the following command:"
  echo "  mount $BACKUP_DEV $BACKUP_DIR"
  echo "CANNOT CONTINUE WITH BACKUP."
  exit 1
fi

date

rsnapshot $BACKUP_TYPE
RET=$?

date

if [ "a$RET" = "a0" ] ; then
  echo "Snapshot performed successfully."
elif [ "a$RET" = "a2" ] ; then
  echo "Snapshot performed, but with warnings."
else
  echo "Snapshot had errors (returned ${RET})."
fi

umount $BACKUP_DIR
if [ "a$?" != "a0" ] ; then
  echo "Error occurred trying to unmount the external drive with the following command:"
  echo "  umount $BACKUP_DIR"
  exit 1
fi

exit $RET

Modify the BACKUP_DEV and BACKUP_DIR variables to suit.

share

I use dirvish to make backups to USB drives. I have several scripts built to mount the active drive, I have 3, to the correct point in the filesystem and then run the backups.

Dirvish is basically just a perl script that calls rsync with many options:

  • you can have keep many backups without wasting space
  • you have a simple configuration syntax
  • restores are very easy
share
    
+1 I also use dirvish. The nice thing is that it creates a complete copy of the tree it is backing up, but files that haven't changed since last backup are hardlinked, so you effectively get a full backup at the cost of an incremental backup. –  sleske Oct 20 '09 at 8:02
    
Only downside is that it does not run on windows (needs hardlinks); also remember to rotate your backup media and store them offsite for maximum security. –  sleske Oct 20 '09 at 8:03

Most of the answers in this question also apply here. Most of the tools mentioned will work fine on linux.

share

Take a look at rdiff-backup. Leaving on the USB drive can't hurt. Atleast it's inexpensive. They don't use a lot of power when they idle.

share

As other answers suggest, using rsync (and/or a wrapper around rsync) is a simple way to make a backup of a linux server. Some things to keep in mind:

  • Is the application data you care about actually getting backed up? If you have a database, you should have a cron job that regularly dumps the data. An rsync of a live database system's file isn't guaranteed to give you a reliable backup.
  • How often are you testing to see whether the backup worked or that your USB disk is still in good shape?
  • What happens to deleted files when you do a backup? If you use something like rsnapshot, you're probably fine. But if you are using rsync with the --delete option, you might not be able to recover files you didn't mean to delete.

A second local disk is probably the cheapest option for having a quick way to recover files if your primary disk fails, but it won't help if your house is struck by lightning (or your cheap power strip melts down)). With so many $5/month offsite backup solutions, it's not a bad idea to do both.

share

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