How can I make an Ubuntu recovery image on external media?

Remastersys is the tool to go for. It allows you to make an ISO image of your system including if you want your data. You can than create a bootable USB stick. My last experience was that the live usb/cd didnt work, but installation worked. In conclusion a perfect toll for your needs and or if you want to transfer a system to a friends computer.


This is rather basic, but it's guaranteed to work, provided you have an external hard drive with enough free space to hod your entire internal drive (including free space)

To Backup

  1. Boot into a live CD/USB environment.
  2. Determine the name of your internal hard drive. Probably, it's /dev/sda, but you should check somewhere to be absolutely sure. I use GParted for this purpose.
  3. Mount your external drive somewhere. I'll use /media/external in these instructions. Be sure that your internal drive is not mounted!
  4. Choose one of the following, depending on your situation. Both make use of dd to image your entire disk, not just individual partitions (you can also use this technique to migrate to an entirely different hard drive of the same size or larger):

    1. If your external drive's filesystem can handle a single file the size of your entire internal drive, you can use the simplest option:

      sudo dd if=/dev/sda of=/media/external/internal_disk.img
      
    2. If you need compression or need to split the image file into multiple smaller files, use this more complex command (see the man pages for any commands you don't understand):

      cd /media/external
      sudo dd if=/dev/sda | bzip2 | split --bytes=2G -d - internal_disk.img.
      

      This will first compress the contents of your disk (bzip2), then split it into 2GB chunks.

  5. Your backup is complete.

To Restore

  1. Boot into a live CD/USB environment.
  2. Mount your external drive. I'll make the same path assumptions as I did above.
  3. Choose the option that corresponds to the choice you made above:

    1. Just copy the image to your hard drive:

      sudo dd if=/media/external/internal_disk.img of=/dev/sda
      
    2. Make sure that there are no other files in your backup directory that have names beginning the same as your backup chunks. Then:

      cd /media/external
      cat internal_disk.img.* | bunzip2 | sudo dd of=/dev/sda
      
  4. Reboot. You're finished.