Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an Acer Aspire One running Lubuntu 10.04. I have configured it quite much and would like to backup the whole file system (excluding my SD card where I keep my data) to be able to get it up and running quickly in case of disaster.

I know there are many discussions on good backup solutions, but I would like help to find a specific solution that is very simple to use. And with that I mean a command line solution, preferably in just one line, that makes a (compressed) copy of the file system to a mounted USB stick.

One of the most important aspects of the solution should of course be that it is very easy to restore the system, even if I forget the details on how I made the backup. So, maybe the USB stick should be bootable and when booted from, it should restore the computer. Or anything else that is about that simple.

Does anyone already do something like this, or is there a backup implementation aimed towards this use case out of the box?

Update

To clarify a bit: if I could get a tangible proposal I would be very happy. Like for example a specific command line:

<command> --from /dev/sda --to /media/usbmemory/backup.bkp

Or whatever would work! :)

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You want to back up the entire system, not just your data? Then I'd suggest a USB stick isn't the right answer. It probably isn't big enough for a single backup, and certainly won't be for multiple backups (otherwise if the system dies during a backup you'll have nothing). I'd suggest a portable hard disk instead.

The advantage of using a hard disk is that you can then do a full install onto it, making it easy to boot from. You can also then boot from it to take backups if you want to ensure your backup is consistent (something rather important when you're trying to do a full system backup).

If you've done that, I'd put together 2 scripts to do the backup, and the restore. Something like:

#!/bin/bash
SOURCE=/dev/sda
DESTINATION=/backup/backup.`date +%Y%m%d-%H%M%S`.bz2

echo "About to back up ${SOURCE} to ${DESTINATION}.  Press ^C to abort"
sleep 10

echo "Backup started"
dd if=${SOURCE} | bzip2 -c9 > ${DESTINATION}

And then

#!/bin/bash
DESTINATION=/dev/sda
SOURCE_BASE=/backup/backup

if [ -z "${1}" ]; then
    SOURCE=`ls -1tr ${SOURCE_BASE}.* | tail -n 1`
    if [ -z "${SOURCE}" ]; then
        echo "No backups found!"
    fi
  else
    if [ ! -e ${1} ]; then
        echo "File ${1} not found to restore from
      else
        SOURCE=${1}
    fi
fi

echo "About to restore ${SOURCE} to ${DESTINATION}.  Press ^C to abort"
sleep 10

echo "Restore started"
bzip2 -cd ${SOURCE} | dd of=${DESTINATION}

That'll ensure that each backup goes to a different location and when you do the restore automatically restore the most recent backup, or the one you specify.

One note of caution - I just wrote those 2 scripts, you probably want to test them before relying on them.

share|improve this answer
    
Very nice! Thanks! I will go through these scripts in detail to see if they will work for me, but I will follow your advice about multiple backups regardless. +1 and accepted. –  Peter Jaric Oct 16 '10 at 11:16

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.