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