Next Previous Contents

3. Usage

There are two ways to use Partition Image:

You can obtain the list of all commands, by typing partimage --help, then we won't explain it. We will study how to use the GUI of Partition Image.

3.1 How to save a partition into an image file

When saving a partiition, you must specify two important things. First, the partition you want to save. You must give the Linux name of the partition, then a file of the /dev/ directory. For example, if the partition to save is the first of your first IDE hard disk, it can be /dev/hda1. The second important thing is the file where to save this partition. This file is named the image file. To see what partitions your have on your hard disk, you can run fdisk or, you can type cat /proc/partitions. Then, you will have to type these two informations on the first window of Partition Image. In the screenshot, we are saving the /dev/hda12 partition to redhat-6.2.partimg.gz. The extension of the image file should fit with the compression mode which will be used (.gz for gzip, and .bz2 for bzip2). When ready, click on Next >

On the next window, you can choose many options. The most important one is the compression level. The size of your image, and the time which will be used to save the image depend on the compression level you use. The split options allow you to split the image file into several small files. It can be useful to save your partition into removable medias, as ZIP drives. For exemple, you can split into files of 95 MB.

When all options are well, you can click on the save button to run the operation.

3.2 How to restore a partition from an image file

Restoring data will copy the data which were saved into an image file, into a partition. Data of the partition to restore will be lost ! The partition you will restore data to must already exists. If it doesn't exists, you must create it before with a tool, such as fdisk, GNU parted, ...

Restoring an image into a partition is an easy operation. You must specify the image file to use (it will only be read), and the partition to restore (it will be overwritten). The only option you can choose is Erase free blocks with zero values. If this options enabled, all blocks which are not used, then all blocks which would not be restored are erased with zero bytes. This may be useful if you want to be sure that the data which were on the partition before this operation are fully erased. If this option is disabled, old data which were on currently unused blocks can be accessed, because nothing is written on these blocks. These old data can be read with tools as dd (GNU convert and copy).

When all options are well, you can click on the restore button to run the operation.

The partition to restore must have the same size as the saved partition. If the partition is smaller than the original one, the operation will fail. If it is bigger, space can be lost. You can read the FAQ of this handbook, to have more details about this.

3.3 What compression level to use ?

When you save a partition into an image file, you can choose one of three compression levels:

With No compression you will have a very big image file, which will have the same size of the used data of your saved partition. This is really interesting only if you have a lot of space. But this is very fast.

With Gzip compression you will have a small image file. This is the most interesting mode, and the default. This takes more time, but this is correct.

With Bzip2 compression you will have a very small image file: Bzip2 has a better compression ratio than gzip on big files. But in some cases, it can increase the size of data. This will be very very slow to compress. Then, this is interesting if you really can't waste space, or if you have a lot of time (you can run it before goinf to bed).

You can compress and uncompress image files, after creation. For example, if the image redhat-6.2.partimg.gz was made with the gzip compression level, you can type gzip -d redhat-6.2.partimg.gz to uncompress the image file. You can also compress an image which was not compressed. For example, you can type bzip2 debian-2.2.partimg. Partition Image will be able to read them after.

3.4 The splitting option

Image files created by Partition Image are very big, and can reach a size of several Giga Bytes sometimes. Then, you can have problems if you want to copy these images to removable medias, or when burning them on CD-R.

Splitting is an option to use when creating an image. It allows to divide a big image file into small files. Three splitting modes are avaibles

You can use the fixed size mode if you want to copy your files into a rmovable media, or a CD-R. For example, to burn your image, you can split it into files of 600 MB. Then, you must write the fixed size to use, in Kilo-Bytes. Then, it would be 614400 KB here for a CD-R.

You can choose the automatic mode if you are not sure there is enough space on the destination image file partition. Then, when no space left, a new location will be asked, and the next volume will be written in this new location. This can be usedful if you directly create your partition into a removable media.


Next Previous Contents