8

it is possible to make a full disk image with running ubuntu with following command:

dd if=/dev/sda of=/image_name

After i make it, how can i restore that image on a crushed system?

3 Answers3

18

Boot from the live cd. Mount your destination media to (say) /mnt.

dd if=/dev/sdXXX of=/mnt/mybackup.ddimg

To restore:

dd if=/mnt/mybackup.ddimg of=/dev/sdXXX

The destination drive should be the same size or bigger than the original.


A better way is using tar.

Mount the source to /mnt, mount the destination to /home (say)

tar cvfpz /home/mybackup.tar.gz /mnt

This can then be restored to any size drive:

tar xvfpz /home/mybackup.tar.gz

(After mounting source to /home and destination to /mnt.)

Then just install grub.

Addison
  • 306
  • 4
  • 13
hatterman
  • 2,330
8

In addition to hatterman's great answer you can compress the image as it's taken using gzip like this:

dd if=/dev/sdx | gzip > /mnt/mybackup.ddimg.gz
1

If what you really want is a full backup of your system disk, I would suggest doing it with Clonezilla: make a Clonezilla Live USB, boot from that, and let it make the full disk image.

If you really want to do it with dd, add the bs= option to define a bigger block size than the default 512B. It will greatly improve the speed of the copy.

For example:

dd if=/dev/sda of=/mnt/image_name bs=1M 
mivk
  • 5,811