| 1 |
// $Revision: 1.1.1.1 $ |
| 2 |
Description of the image file format for Partition Image which will |
| 3 |
be used in the 0.6 versions |
| 4 |
------------------- |
| 5 |
Web: http://www.partimage.org/ |
| 6 |
|
| 7 |
========================= INFO ========================== |
| 8 |
|
| 9 |
* There will be a magic string between each important structures |
| 10 |
(for example between CVolumeHeader and the data) |
| 11 |
* The CRC must be increased if the current byte is null. For example, use: |
| 12 |
for (i=0; i < size; i++) |
| 13 |
qwCRC += (data[i] ^ 94); |
| 14 |
|
| 15 |
=============== GENERAL IMAGE FILE FORMAT =============== |
| 16 |
|
| 17 |
Volume 000: |
| 18 |
----------- |
| 19 |
* CVolumeHeader // The first volume is a regular volume |
| 20 |
* CMainHeader // contains the number of MBR saved |
| 21 |
* --mbr-- |
| 22 |
* --data-- |
| 23 |
|
| 24 |
Volume XXX: |
| 25 |
----------- |
| 26 |
* CVolumeHeader |
| 27 |
* --data-- |
| 28 |
|
| 29 |
Volume last: |
| 30 |
------------ |
| 31 |
* CVolumeHeader |
| 32 |
* --data-- |
| 33 |
* CMainTail |
| 34 |
|
| 35 |
===================== DATA FORMAT ====================== |
| 36 |
|
| 37 |
* Block 000: |
| 38 |
|
| 39 |
* ... |
| 40 |
|
| 41 |
* Block XXX: |
| 42 |
+ UINT nCRC: |
| 43 |
[0..65500]: ((16 bits CRC of the data of the block) mod (65500)) |
| 44 |
65500 -> code001: it mean the size of the next variable used to encode |
| 45 |
the block number is larger (24 bits -> 32 bits; |
| 46 |
32 bits -> 40 bits; 40 bits -> 56 bits; 56 bits -> 64 bits) |
| 47 |
[65502..65535] -> codeXXX: reserved for futur use |
| 48 |
If a code was used, then another UINT is written for the real CRC |
| 49 |
+ ???? nBlockNumber: Number of the block which will be saved. This avoid to |
| 50 |
restore the data of the block X |
| 51 |
in the block Y. |
| 52 |
+ --contents of the block-- // (between 512 and 32768 bytes in most cases) |
| 53 |
|
| 54 |
========================= MBR ============================= |
| 55 |
* CMbr 000: |
| 56 |
|
| 57 |
* ... |
| 58 |
|
| 59 |
* CMbr XXX: |
| 60 |
struct CMBr |
| 61 |
{ |
| 62 |
char m_cData[512]; |
| 63 |
char *szDevice[MAX_DEVICELEN]; // ex: "hda" |
| 64 |
<type> m_DeviceIdentificator; |
| 65 |
} |
| 66 |
|
| 67 |
When creating an image, all the MBR of the physical hard disks will be saved. |
| 68 |
If not useful, only a few KB will be lost. But it can be very useful. The number |
| 69 |
of MBR saved in written in the MBR. With the 512 bytes of the MBR, we save the |
| 70 |
identificator of the device. It can be a serial number, or the contents of |
| 71 |
"/proc/ide/hda/model". It will be used to check the MBR we are restoring fit |
| 72 |
with the original hard drive, to avoid errors. We will also add an option to |
| 73 |
restore the MBR from an image file. |
| 74 |
|
| 75 |
======== STRUCTURES INFORMATIONS =========== |
| 76 |
|
| 77 |
* CVolumeHeader |
| 78 |
Contains first a magic string "partimage" to check this is a partimage volume. |
| 79 |
It also contains the partition image version used to create it. |
| 80 |
|
| 81 |
* CMainHeader |
| 82 |
Contains infos which describe all the partitions of the image file, as |
| 83 |
the date/time of the image creation, the description, ... |
| 84 |
|
| 85 |
* CMainTail |
| 86 |
Contains informations to check the operation success, as the global 64 bits CRC |