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
    Three things I would suggest. One: do it from a live CD. Two: make sure the image you create is not on the same volume as the one being copied. Three: this will probably only work if both hard drives are the same size. – zeitue Aug 11 '14 at 5:54
  • How can i do that from liveCD? AFAIK from liveCD you can't do any write actions. – Alexander Kim Aug 11 '14 at 6:39
  • @Heihachi why would you not be able to write to a harddisk from a live DVD? – Rinzwind Aug 11 '14 at 7:34
  • I would suggest using a USB hard drive as the location to sent the image – zeitue Aug 11 '14 at 8:14

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

dd if=/dev/sd whatever of=/mnt/mybackup.ddimg

To restore:

dd if=/mnt/mybackup.ddimg of=/dev/sd wharever

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.

  • Any particular reason for .ddimg? – Hashim Mar 30 '18 at 23:12
  • This question is 3 years old, however feel free to ask the OP why he wanted to use dd – hatterman Mar 31 '18 at 10:53
  • No, my question was about the .ddimg extension that you used. I know enough about dd to know the extension of an image file is largely irrelevant, so I'm wondering whether there's a particular reason you used .ddimg instead of the more common .img or .dd that I've seen, or even no extension at all. – Hashim Mar 31 '18 at 22:32
  • 1
    No reason, its just so I know what the file is further down the line. Just my preference. – hatterman Apr 1 '18 at 11:04

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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