virtual revision 1.1.1.7 1 1.1 christos
2 1.1 christos #------------------------------------------------------------------------------
3 1.1.1.7 christos # $File: virtual,v 1.17 2022/08/23 08:00:54 christos Exp $
4 1.1 christos # From: James Nobis <quel (a] quelrod.net>
5 1.1 christos # Microsoft hard disk images for:
6 1.1 christos # Virtual Server
7 1.1 christos # Virtual PC
8 1.1.1.4 christos # VirtualBox
9 1.1.1.4 christos # URL: http://fileformats.archiveteam.org/wiki/VHD_(Virtual_Hard_Disk)
10 1.1.1.4 christos # Reference: https://download.microsoft.com/download/f/f/e/ffef50a5-07dd-4cf8-aaa3-442c0673a029/
11 1.1.1.4 christos # Virtual%20Hard%20Disk%20Format%20Spec_10_18_06.doc
12 1.1.1.7 christos 0 string conectix Microsoft Disk Image, Virtual Server or Virtual PC
13 1.1.1.4 christos # alternative shorter names
14 1.1.1.7 christos #0 string conectix Microsoft Virtual Hard Disk image
15 1.1.1.7 christos #0 string conectix Microsoft Virtual HD image
16 1.1.1.4 christos !:mime application/x-virtualbox-vhd
17 1.1.1.4 christos !:ext vhd
18 1.1.1.4 christos # Features is a bit field used to indicate specific feature support
19 1.1.1.7 christos #>8 ubelong !0x00000002 \b, Features %#x
20 1.1.1.4 christos # Reserved. This bit must always be set to 1.
21 1.1.1.7 christos #>8 ubelong &0x00000002 \b, Reserved %#x
22 1.1.1.4 christos # File Format Version for the current specification 0x00010000
23 1.1.1.7 christos #>12 ubelong !0x00010000 \b, Version %#8.8x
24 1.1.1.4 christos # Data Offset only found 0x200
25 1.1.1.7 christos #>16 ubequad !0x200 \b, Data Offset %#llx
26 1.1.1.7 christos #>16 ubequad x \b, at %#llx
27 1.1.1.4 christos # Dynamic Disk Header cookie like cxsparse
28 1.1.1.4 christos #>(16.Q) string x "%-.8s"
29 1.1.1.4 christos # This field contains a Unicode string (UTF-16) of the parent hard disk filename
30 1.1.1.7 christos #>(16.Q+64) ubequad x \b, parent name %#llx
31 1.1.1.4 christos # Creator Application
32 1.1.1.4 christos # vpc~Microsoft Virtual PC, vs~Microsoft Virtual Server, vbox~VirtualBox, d2v~disk2vhd
33 1.1.1.4 christos >28 string x \b, Creator %-4.4s
34 1.1.1.4 christos # Creator Version: 0x00010000~Virtual Server 2004, 0x00050000~Virtual PC 2004
35 1.1.1.4 christos # holds the major/minor version of the application that created the image
36 1.1.1.4 christos >32 ubeshort x %x
37 1.1.1.4 christos >34 ubeshort x \b.%x
38 1.1.1.7 christos #>32 ubelong x \b, Version %#8.8x
39 1.1.1.4 christos # Creator Host OS: 0x5769326B~Windows (Wi2k), 0x4D616320~Macintosh (Mac)
40 1.1.1.4 christos >36 ubelong x (
41 1.1.1.4 christos >>36 ubelong 0x5769326B \bW2k
42 1.1.1.4 christos >>36 ubelong 0x4D616320 \bMac
43 1.1.1.4 christos >>36 default x \b0x
44 1.1.1.4 christos >>>36 ubelong x \b%8.8x
45 1.1.1.4 christos # creation Time in seconds since 1 Jan 2000 UTC~946684800 sec. since Unix Epoch
46 1.1.1.4 christos >24 bedate+946684800 x \b) %s
47 1.1.1.4 christos # Original Size
48 1.1.1.7 christos #>40 ubequad x \b, o.-Size %#llx
49 1.1.1.4 christos # Current Size is same as original size, but change when disk is expanded
50 1.1.1.7 christos #>48 ubequad x \b, Size %#llx
51 1.1.1.4 christos >48 ubequad x \b, %llu bytes
52 1.1.1.4 christos # Disk Geometry: cylinder, heads, and sectors/track for hard disk
53 1.1.1.7 christos #>56 ubeshort x \b, Cylinder %#x
54 1.1.1.4 christos >56 ubeshort x \b, CHS %u
55 1.1.1.4 christos # Heads
56 1.1.1.7 christos #>58 ubyte x \b, Heads %#x
57 1.1.1.4 christos >58 ubyte x \b/%u
58 1.1.1.4 christos # Sectors per track
59 1.1.1.7 christos #>59 ubyte x \b, Sectors %#x
60 1.1.1.4 christos >59 ubyte x \b/%u
61 1.1.1.4 christos # Disk Type: 3~Dynamic hard disk
62 1.1.1.7 christos >60 ubelong !0x3 \b, type %#x
63 1.1.1.4 christos # Checksum
64 1.1.1.7 christos #>64 ubelong x \b, cksum %#x
65 1.1.1.4 christos # universally unique identifier (UUID) to associate a parent with its differencing image
66 1.1.1.7 christos #>68 ubequad x \b, id %#16.16llx
67 1.1.1.4 christos #>76 ubequad x \b-%16.16llx
68 1.1.1.4 christos # Saved State: 1~Saved State
69 1.1.1.7 christos >84 ubyte !0 \b, State %#x
70 1.1.1.4 christos # Reserved 427 bytes with nils
71 1.1.1.7 christos #>85 ubequad !0 \b, Reserved %#16.16llx
72 1.1.1.4 christos
73 1.1.1.4 christos # From: Joerg Jenderek
74 1.1.1.4 christos # URL: https://msdn.microsoft.com/en-us/library/mt740058.aspx
75 1.1.1.4 christos # Reference: https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/
76 1.1.1.4 christos # MS-VHDX/[MS-VHDX].pdf
77 1.1.1.4 christos # Note: extends the VHD format with new capabilities, such as a 16TB maximum size
78 1.1.1.4 christos # TODO: find and display values like virtual size, disk size, cluster_size, etc
79 1.1.1.4 christos # display id in GUID format
80 1.1.1.4 christos #
81 1.1.1.4 christos # VHDX_FILE_IDENTIFIER signature 0x656C696678646876
82 1.1.1.4 christos 0 string vhdxfile
83 1.1.1.4 christos # VHDX_HEADER signature. 1 header is stored at offset 64KB and the other at 128KB
84 1.1.1.4 christos >0x10000 string head Microsoft Disk Image eXtended
85 1.1.1.4 christos #>0x20000 string head \b, 2nd header
86 1.1.1.4 christos #!:mime application/x-virtualbox-vhdx
87 1.1.1.4 christos !:ext vhdx
88 1.1.1.4 christos # Creator[256] like "QEMU v3.0.0", "Microsoft Windows 6.3.9600.18512"
89 1.1.1.4 christos >>8 lestring16 x \b, by %.256s
90 1.1.1.4 christos # The Checksum field is a CRC-32C hash over the entire 4 KB structure
91 1.1.1.7 christos #>>0x10004 ulelong x \b, CRC %#x
92 1.1.1.4 christos # SequenceNumber
93 1.1.1.7 christos >>0x10008 ulequad x \b, sequence %#llx
94 1.1.1.4 christos # FileWriteGuid
95 1.1.1.7 christos #>>0x10010 ubequad x \b, file id %#llx
96 1.1.1.4 christos #>>>0x10018 ubequad x \b-%llx
97 1.1.1.4 christos # DataWriteGuid
98 1.1.1.7 christos #>>0x10020 ubequad x \b, data id %#llx
99 1.1.1.4 christos #>>>0x10028 ubequad x \b-%llx
100 1.1.1.4 christos # LogGuid. If this field is zero, then the log is empty or has no valid entries
101 1.1.1.7 christos >>0x10030 ubequad >0 \b, log id %#llx
102 1.1.1.4 christos >>>0x10038 ubequad x \b-%llx
103 1.1.1.4 christos # LogVersion. If not 0 there is a log to replay
104 1.1.1.7 christos >>0x10040 uleshort >0 \b, LogVersion %#x
105 1.1.1.4 christos # Version. This field must be set to 1
106 1.1.1.7 christos >>0x10042 uleshort !1 \b, Version %#x
107 1.1.1.4 christos # LogLength must be multiples of 1 MB
108 1.1.1.4 christos >>0x10044 ulelong/1048576 >1 \b, LogLength %u MB
109 1.1.1.4 christos # LogOffset (normally 0x100000 when log direct after header); multiples of 1 MB
110 1.1.1.7 christos >>0x10048 ulequad !0x100000 \b, LogOffset %#llx
111 1.1.1.4 christos # Log Entry Signature must be 0x65676F6C~loge
112 1.1.1.4 christos >>(0x10048.q) ulelong !0x65676F6C \b, NO Log Signature
113 1.1.1.4 christos >>(0x10048.q) ulelong =0x65676F6C \b; LOG
114 1.1.1.4 christos # Log Entry Checksum
115 1.1.1.7 christos #>>>(0x10048.q+4) ulelong x \b, Log CRC %#x
116 1.1.1.4 christos # Log Entry Length must be a multiple of 4 KB
117 1.1.1.4 christos >>>(0x10048.q+8) ulelong/1024 >4 \b, EntryLength %u KB
118 1.1.1.4 christos # Log Entry Tail must be a multiple of 4 KB
119 1.1.1.7 christos #>>>(0x10048.q+12) ulelong x \b, Tail %#x
120 1.1.1.4 christos # Log Entry SequenceNumber
121 1.1.1.7 christos #>>>(0x10048.q+16) ulequad x \b, # %#llx
122 1.1.1.4 christos # Log Entry DescriptorCount may be zero. only 4 bytes in other docs instead 8
123 1.1.1.7 christos #>>>(0x10048.q+24) ulelong x \b, DescriptorCount %#llx
124 1.1.1.4 christos # Log Entry Reserved must be set to 0
125 1.1.1.7 christos >>>(0x10048.q+28) ulelong !0 \b, Reserved %#x
126 1.1.1.4 christos # Log Entry LogGuid
127 1.1.1.7 christos #>>>(0x10048.q+32) ubequad x \b, Log id %#llx
128 1.1.1.4 christos #>>>(0x10048.q+40) ubequad x \b-%llx
129 1.1.1.4 christos # Log Entry FlushedFileOffset should VHDX size when entry is written.
130 1.1.1.4 christos #>>>(0x10048.q+48) ulequad x \b, FlushedFileOffset %llu
131 1.1.1.4 christos # Log Entry LastFileOffset
132 1.1.1.4 christos #>>>(0x10048.q+56) ulequad x \b, LastFileOffset %llu
133 1.1.1.4 christos # filling
134 1.1.1.4 christos #>>>(0x10048.q+64) ulequad >0 \b, filling %llx
135 1.1.1.4 christos # Reserved[4016]
136 1.1.1.7 christos #>>0x10050 ulequad >0 \b, Reserved %#llx
137 1.1.1.4 christos # VHDX_REGION_TABLE_HEADER Signature 0x69676572~regi at offset 192 KB and 256 KB
138 1.1.1.4 christos >0x30000 ulelong !0x69676572 \b, 1st region INVALID
139 1.1.1.4 christos >0x30000 ulelong =0x69676572 \b; region
140 1.1.1.4 christos # region Checksum. CRC-32C hash over the entire 64-KB table
141 1.1.1.7 christos #>>0x30004 ulelong x \b, CRC %#x
142 1.1.1.4 christos # The EntryCount specifies number of valid entries; Found 2; This must be =< 2047.
143 1.1.1.4 christos >>0x30008 ulelong x \b, %u entries
144 1.1.1.4 christos # reserved must be zero
145 1.1.1.7 christos #>>0x3000C ulelong !0 \b, RESERVED %#x
146 1.1.1.4 christos # Region Table Entry starts with identifier for the object. often BAT id
147 1.1.1.4 christos >>0x30010 use vhdx-id
148 1.1.1.4 christos # FileOffset
149 1.1.1.7 christos >>0x30020 ulequad x \b, at %#llx
150 1.1.1.4 christos # Length. Specifies the length of the object within the file
151 1.1.1.7 christos #>>0x30028 ulelong x \b, Length %#x
152 1.1.1.4 christos # 1 means region entry is required. if region not recognized, then REFUSE to load VHDX
153 1.1.1.4 christos >>0x3002C ulelong x \b, Required %u
154 1.1.1.4 christos # 2nd region entry often metadata id
155 1.1.1.4 christos >>0x30030 use vhdx-id
156 1.1.1.4 christos # 2nd entry FileOffset
157 1.1.1.7 christos >>0x30040 ulequad x \b, at %#llx
158 1.1.1.4 christos # 1 means region entry is required. if region not recognized, then REFUSE to load VHDX
159 1.1.1.4 christos >>0x3004C ulelong x \b, Required %u
160 1.1.1.4 christos # 2nd region
161 1.1.1.4 christos >>0x40000 ulelong !0x69676572 \b, 2nd region INVALID
162 1.1.1.4 christos # check in vhdx images for known id and show names instead hexadecimal
163 1.1.1.4 christos 0 name vhdx-id
164 1.1.1.4 christos # https://www.windowstricks.in/online-windows-guid-converter
165 1.1.1.4 christos # 2DC27766-F623-4200-9D64-115E9BFD4A08 BAT GUID
166 1.1.1.4 christos # 6677C22D23F600429D64115E9BFD4A08 BAT ID
167 1.1.1.4 christos >0 ubequad =0x6677C22D23F60042
168 1.1.1.4 christos >>8 ubequad =0x9D64115E9BFD4A08 \b, id BAT
169 1.1.1.4 christos # no BAT id
170 1.1.1.4 christos >>8 default x
171 1.1.1.4 christos >>>0 use vhdx-id-hex
172 1.1.1.4 christos # 8B7CA206-4790-4B9A-B8FE-575F050F886E Metadata region GUID
173 1.1.1.4 christos # 06A27C8B90479A4BB8FE575F050F886E Metadata region ID
174 1.1.1.4 christos >0 ubequad =0x06A27C8B90479A4B
175 1.1.1.4 christos >>8 ubequad =0xB8FE575F050F886E \b, id Metadata
176 1.1.1.4 christos # no Metadata id
177 1.1.1.4 christos >>8 default x
178 1.1.1.4 christos >>>0 use vhdx-id-hex
179 1.1.1.4 christos # 2FA54224-CD1B-4876-B211-5DBED83BF4B8 Virtual Disk Size GUID
180 1.1.1.4 christos # 2442A52F1BCD7648B2115DBED83BF4B8 Virtual Disk Size ID
181 1.1.1.4 christos # value "virtual size" can be verified by command `qemu-img info `
182 1.1.1.4 christos >0 ubequad =0x2442A52F1BCD7648
183 1.1.1.4 christos >>8 ubequad =0xB2115DBED83BF4B8 \b, id vsize
184 1.1.1.4 christos # no Virtual Disk Size ID
185 1.1.1.4 christos >>8 default x
186 1.1.1.4 christos >>>0 use vhdx-id-hex
187 1.1.1.4 christos # other ids
188 1.1.1.4 christos >0 default x
189 1.1.1.4 christos >>0 use vhdx-id-hex
190 1.1.1.4 christos # in vhdx images show id as hexadecimal
191 1.1.1.4 christos 0 name vhdx-id-hex
192 1.1.1.7 christos >0 ubequad x \b, ID %#16.16llx
193 1.1.1.4 christos >8 ubequad x \b-%16.16llx
194 1.1.1.4 christos #
195 1.1.1.3 christos # libvirt
196 1.1.1.3 christos # From: Philipp Hahn <hahn (a] univention.de>
197 1.1.1.3 christos 0 string LibvirtQemudSave Libvirt QEMU Suspend Image
198 1.1.1.3 christos >0x10 lelong x \b, version %u
199 1.1.1.3 christos >0x14 lelong x \b, XML length %u
200 1.1.1.3 christos >0x18 lelong 1 \b, running
201 1.1.1.3 christos >0x1c lelong 1 \b, compressed
202 1.1.1.3 christos
203 1.1.1.3 christos 0 string LibvirtQemudPart Libvirt QEMU partial Suspend Image
204 1.1.1.3 christos # From: Alex Beregszaszi <alex (a] fsn.hu>
205 1.1.1.3 christos 0 string/b COWD VMWare3
206 1.1.1.3 christos >4 byte 3 disk image
207 1.1.1.3 christos >>32 lelong x (%d/
208 1.1.1.3 christos >>36 lelong x \b%d/
209 1.1.1.3 christos >>40 lelong x \b%d)
210 1.1.1.3 christos >4 byte 2 undoable disk image
211 1.1.1.3 christos >>32 string >\0 (%s)
212 1.1.1.3 christos
213 1.1.1.3 christos 0 string/b VMDK VMware4 disk image
214 1.1.1.3 christos 0 string/b KDMV VMware4 disk image
215 1.1.1.3 christos
216 1.1.1.3 christos #--------------------------------------------------------------------
217 1.1.1.3 christos # Qemu Emulator Images
218 1.1.1.3 christos # Lines written by Friedrich Schwittay (f.schwittay (a] yousable.de)
219 1.1.1.3 christos # Updated by Adam Buchbinder (adam.buchbinder (a] gmail.com)
220 1.1.1.3 christos # Made by reading sources, reading documentation, and doing trial and error
221 1.1.1.3 christos # on existing QCOW files
222 1.1.1.7 christos 0 string/b QFI\xFB QEMU QCOW Image
223 1.1.1.7 christos !:mime application/x-qemu-disk
224 1.1.1.3 christos
225 1.1.1.3 christos # Uncomment the following line to display Magic (only used for debugging
226 1.1.1.3 christos # this magic number)
227 1.1.1.3 christos #>0 string/b x , Magic: %s
228 1.1.1.3 christos
229 1.1.1.3 christos # There are currently 2 Versions: "1" and "2".
230 1.1.1.4 christos # https://www.gnome.org/~markmc/qcow-image-format-version-1.html
231 1.1.1.7 christos >4 belong x (v%d)
232 1.1.1.3 christos
233 1.1.1.3 christos # Using the existence of the Backing File Offset to determine whether
234 1.1.1.3 christos # to read Backing File Information
235 1.1.1.3 christos >>12 belong >0 \b, has backing file (
236 1.1.1.3 christos # Note that this isn't a null-terminated string; the length is actually
237 1.1.1.3 christos # (16.L). Assuming a null-terminated string happens to work usually, but it
238 1.1.1.3 christos # may spew junk until it reaches a \0 in some cases.
239 1.1.1.3 christos >>>(12.L) string >\0 \bpath %s
240 1.1.1.3 christos
241 1.1.1.3 christos # Modification time of the Backing File
242 1.1.1.3 christos # Really useful if you want to know if your backing
243 1.1.1.3 christos # file is still usable together with this image
244 1.1.1.3 christos >>>>20 bedate >0 \b, mtime %s)
245 1.1.1.3 christos >>>>20 default x \b)
246 1.1.1.3 christos
247 1.1.1.3 christos # Size is stored in bytes in a big-endian u64.
248 1.1.1.3 christos >>24 bequad x \b, %lld bytes
249 1.1.1.3 christos
250 1.1.1.3 christos # 1 for AES encryption, 0 for none.
251 1.1.1.3 christos >>36 belong 1 \b, AES-encrypted
252 1.1.1.3 christos
253 1.1.1.4 christos # https://www.gnome.org/~markmc/qcow-image-format.html
254 1.1.1.3 christos >4 belong 2 (v2)
255 1.1.1.3 christos # Using the existence of the Backing File Offset to determine whether
256 1.1.1.3 christos # to read Backing File Information
257 1.1.1.3 christos >>8 bequad >0 \b, has backing file
258 1.1.1.3 christos # Note that this isn't a null-terminated string; the length is actually
259 1.1.1.3 christos # (16.L). Assuming a null-terminated string happens to work usually, but it
260 1.1.1.3 christos # may spew junk until it reaches a \0 in some cases. Also, since there's no
261 1.1.1.3 christos # .Q modifier, we just use the bottom four bytes as an offset. Note that if
262 1.1.1.3 christos # the file is over 4G, and the backing file path is stored after the first 4G,
263 1.1.1.3 christos # the wrong filename will be printed. (This should be (8.Q), when that syntax
264 1.1.1.3 christos # is introduced.)
265 1.1.1.3 christos >>>(12.L) string >\0 (path %s)
266 1.1.1.3 christos >>24 bequad x \b, %lld bytes
267 1.1.1.3 christos >>32 belong 1 \b, AES-encrypted
268 1.1.1.3 christos
269 1.1.1.3 christos >4 belong 3 (v3)
270 1.1.1.3 christos # Using the existence of the Backing File Offset to determine whether
271 1.1.1.3 christos # to read Backing File Information
272 1.1.1.3 christos >>8 bequad >0 \b, has backing file
273 1.1.1.3 christos # Note that this isn't a null-terminated string; the length is actually
274 1.1.1.3 christos # (16.L). Assuming a null-terminated string happens to work usually, but it
275 1.1.1.3 christos # may spew junk until it reaches a \0 in some cases. Also, since there's no
276 1.1.1.3 christos # .Q modifier, we just use the bottom four bytes as an offset. Note that if
277 1.1.1.3 christos # the file is over 4G, and the backing file path is stored after the first 4G,
278 1.1.1.3 christos # the wrong filename will be printed. (This should be (8.Q), when that syntax
279 1.1.1.3 christos # is introduced.)
280 1.1.1.3 christos >>>(12.L) string >\0 (path %s)
281 1.1.1.3 christos >>24 bequad x \b, %lld bytes
282 1.1.1.3 christos >>32 belong 1 \b, AES-encrypted
283 1.1.1.3 christos
284 1.1.1.3 christos >4 default x (unknown version)
285 1.1.1.3 christos
286 1.1.1.3 christos 0 string/b QEVM QEMU suspend to disk image
287 1.1.1.3 christos
288 1.1.1.3 christos # QEMU QED Image
289 1.1.1.4 christos # https://wiki.qemu.org/Features/QED/Specification
290 1.1.1.3 christos 0 string/b QED\0 QEMU QED Image
291 1.1.1.3 christos
292 1.1.1.3 christos # VDI Image
293 1.1 christos # Sun xVM VirtualBox Disk Image
294 1.1.1.2 christos # From: Richard W.M. Jones <rich (a] annexia.org>
295 1.1.1.2 christos # VirtualBox Disk Image
296 1.1.1.2 christos 0x40 ulelong 0xbeda107f VirtualBox Disk Image
297 1.1.1.2 christos >0x44 uleshort >0 \b, major %u
298 1.1.1.2 christos >0x46 uleshort >0 \b, minor %u
299 1.1.1.3 christos >0 string >\0 (%s)
300 1.1.1.3 christos >368 lequad x \b, %lld bytes
301 1.1.1.3 christos
302 1.1.1.3 christos 0 string/b Bochs\ Virtual\ HD\ Image Bochs disk image,
303 1.1.1.3 christos >32 string x type %s,
304 1.1.1.3 christos >48 string x subtype %s
305 1.1.1.3 christos
306 1.1.1.3 christos 0 lelong 0x02468ace Bochs Sparse disk image
307 1.1.1.3 christos
308