Backing_Up

Backing up images for install testing

Testing certain upgrade and install scenarios such as Wubi and Migration Assistant require a configuration of existing partitions of Linux and/or Windows installs. Some of this can be done in a virtual environment but it is sometimes desirable to perform this testing on real hardware.

This guide describes how to back up existing partitions to another partition or to external storage so that the setup used for testing can be preserved and tests can be repeated efficiently.

Creating a backup image

This guide assumes that you are backing up your partitions to an external USB drive. A local partition or a network resource can also be used.

Step 1: Download and burn an Ubuntu Live CD.

Step 2: When you boot the Live CD your external USB drive should be mounted automatically, most likely under /media/disk. If not, mount it manually with:

sudo mkdir /mnt/sda5  
sudo mount -t ext3 /dev/sda5 /mnt/sda5

where sda5 is the USB HD device name. If you are unsure of the device name then type "dmesg | tail" and that should notify of the last event that happened, adding the USB HD. You should see a line like [32857.174839] sdb: sdb1 (this means that the device name is sdb1)

Step 3: Install the partimage program

  • Enable the universe repository from System -> Administration -> Software Sources

universe.png

  • Install partimage; at a terminal enter:

sudo apt-get install partimage

Alternative: If you install the Live system on USB pen drive in persistent mode you can install partimage once and use repeatedly. An alternative is System Rescue CD, a Live CD with partimage already installed.

Step 4: Run partimage

sudo partimage

You will see the following text-based GUI:

partimage-2.png

Navigate using TAB, SHIFT-TAB and arrow keys, then activate items with SPACE.

  • First ensure that the correct partition for backing up is highlighted.
  • Next hit tab and type in the name of the file to backup up to. Make it easy to remember and include the path (example "/mnt/sda5/my_main_pc").
  • Ensure "save partition into new image file" is selected and press F5 to proceed. (If you are backing up on a USB HD you don't need to worry about networking)
  • Gzip should be highlighted, so leave that as is. Hit tab till you get to "Quit" then hit space.
  • Hit tab again until you get to "Automatic split (when no space is left)" and hit space. Hit F5 and type in a description (this is useful for backup purposes). Then hit tab and space.
  • On the final page you may get a warning depending on what filesystem you are backing up. Then you will get a report on what is going to happen hit "tab" then "space" and it will start the backup.

The image created will end in ".000" this is in case it needs to continue the image over multiple files.

Alternative: Local partition or network drive. Use qtparted ot gparted to create a spare partition on your drive for backing up to.

Restoring from the backup

Step 1: Boot from your Live CD and install partimage as above.

Step 1: Mount the USB drive as above.

Step 3: Run partimage.

  • This time highlight the partition you wish to write the image to (please ensure it is the same size it was when you created the image otherwise this step will fail).
  • Hit tab now type in the path and name of the file you want to backup from (in this example "/mnt/sda5/my_main_pc.000" note the ".000" at the end it won't find the image without this).
  • Hit tab again until you get to "restore partition from an image file" and hit space.
  • Hit F5, on the next page if you only want the image you created hit tab until you get to "Fill spaces with 0's" and hit "space".
  • Hit tab until you get to "Quit".
  • Once that is done hit F5 that should pop up a similar report to the backup process hit "tab" and then "space".

That should then start the restore process. Wait for it to finish. Your now good to go.

Step 4: Fixing MBR.

  • By default Partimage doesn't restore the MBR (the file that boots the pc). Because of this you will need to run the following command to restore the MBR:

partimage restmbr /mnt/sda5/my_main_pc.000

Testing/Backing_Up (last edited 2008-08-06 16:59:50 by localhost)