2

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.

JAG
  • 121

3 Answers3

0

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

Eliah Kagan
  • 117,780
Malee
  • 211
0

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.

Tynach
  • 205
  • 1
  • 6
0

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"