Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
How to make a disk image and restore from it later?

I'm looking for a solution to create an exact copy of my system that I can restore in case of hard disk failure by simply putting a new hard drive and restoring from the backup. Something like Acronis TrueImage.

I'm not interested in file based backups, although it'd be a plus.

share|improve this question
add comment

marked as duplicate by Marco Ceppi May 13 '11 at 12:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers

A bit of overkill, but you can use the 'dd' command for this. 'dd' stands for Disk Dump, and will dump an exact duplicate, bit by bit, of a hard drive into a file. I've only used this to create CD and DVD iso files myself, so I don't know if there's anything specific when using a hard drive... But it's worth looking into.

For creating an ISO for a CD, the command is:

dd if=/dev/cdrom of=/path/to/file.iso

You can read more about dd in it's man page (man dd), and probably there's a tutorial somewhere for exactly what you want online. Here's one I found with a quick google search: http://www.linuxweblog.com/dd-image

Edit: I don't know if this is relevant or not, but CDs are generally read-only, whereas your hard drive probably is not... And probably is having data written to it even when you don't realize it. So, it's probably a good idea to run these commands from the LiveCD, and not from the hard drive you're trying to back up.

share|improve this answer
    
dd if=/dev/sda of=/where/image/should/be –  Scott Severance May 13 '11 at 6:14
add comment

The most primitive way I've used in the past: cp

sudo cp /dev/sda /media/backup/my-backup-file

Restore can be done:

sudo cp /media/backup/my-backup-file /dev/sda

Not sure if this works with any hard drive but had no problems so far.

You may as well add compression easily:

sudo sh -c "cat /dev/sda |gzip -c > /media/backup/my-backup-file.gz"

sudo sh -c "gzip -dc /media/backup/my-backup-file.gz > /dev/sda"

share|improve this answer
add comment

Get yourself a copy of Parted Magic. It is fantastic.

share|improve this answer
add comment

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