Using PartImage in Ubuntu

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Note: In case you couldn't tell from the extremely old screenshots, this tutorial is no longer maintained. More importantly, PartImage does not support Ext4 partitions, and Ubuntu defaults to the Ext4 filesystem format. I'm told PartClone (which does support Ext4) is a good alternative. You might also want to look into CloneZilla.

PartImage is a program that will copy the image of an entire partition, making it easy to restore a partition (including all its programs, files, and directories) exactly as they were before.

It comes in handy for two situations:

  • Creating a simple backup of your installation in case you're planning to make major changes to it. That way, in case the upgrade or other major change causes problems, you can easily restore your partition to exactly the way it was before.
  • Using the same Ubuntu configuration on several of computers that have the exact same hardware.
This tutorial assumes that you have a Ubuntu live CD and somewhere you can save the partition (an external hard drive or another partition).

Your first step is to boot up the live CD.

Then, go to the terminal. (If you're using Ubuntu 7.10 or earlier, you may have to enable extra repositories before you can install PartImage).

To install PartImage paste in the terminal the command:

sudo apt-get update && sudo apt-get install partimage

After it's been installed, you may need to find out the names of your partitions. To do so, type:

sudo fdisk -l

I happen to be, for this example, backing up my partition to another partition (I'm backing up /dev/hda1 on /dev/hda5. But if you're backing up your partition to an external hard drive, you should plug in the external hard drive before typing

sudo fdisk -l

This part, you can skip if you external hard drive gets automounted.

In my case, I'm going to have to create a mount point (/backup) and then mount /dev/hda5 on the mount point.

Keep in mind--the partition to be backed up should not be mounted.
The partition you're backing up to should be mounted, though.

To run PartImage, type

sudo partimage

Once you launch PartImage, use the Up and Down arrows to select which partition to back up.

Type the name of the path and file where you're going to back up the partition. Since I mounted the backup partition at /backup, I have to type /backup/hda1partition and not just hda1partition. You can use whatever name you want, though. I could have called it /backup/gobbledygook

Action to be done should be Save partition into a new image file.

Then tab to <Next (F5)> and press Enter to move to the next screen.

On the next screen, use no compression if you want the backup to be quicker. You really should use the Gzip or Bzip2 options only if your external hard drive or other backup partition is too small to hold the contents of the partition you're backing up.

Keep in mind, though, that the backup will save only the used space on the partition.

So, if you have a 30 GB partition you're backing up and only 7 GB of it is used, the partition image will be only 7 GB.

For the rest of the options, the defaults are good.

Tab to <Continue (F5)> and press Enter

You'll then be asked to give the new image a description. Type whatever you want.

After PartImage examines the partition data for a while, it'll give a summary of the partition.

Once you press Enter on the last screen, PartImage will start saving your partition to an image file on the backup partition.

My back up was on an extremely slow computer, so it took over an hour, but if you have more than a 766 MHz processor and 128 MB of RAM, then you should get a faster backup time.

And when you're done you'll get this screen.

Then, you'll be back to the terminal prompt, and you can reboot.

The restore process is very similar except that you choose the Restore partition from an image file option when PartImage launches.

You can find more good information about how to use PartImage at its website: www.partimage.org

If you have suggestions or corrections for these tutorials, please post in this Ubuntu Forums thread or leave a comment on my blog.

I will not give help to people posting in the above places. If you require technical support, start a support thread on the Ubuntu Forums. That is the appropriate place to ask for help.