• R/O
  • HTTP
  • SSH
  • HTTPS

7-Zip: コミット

7-Zipの日本語リソースを管理


コミットメタ情報

リビジョンb4bc46ecc8efe3e9d0ad14146184de3315d1540e (tree)
日時2016-05-23 16:51:20
作者nabeshin <nabeshin@user...>
コミッターnabeshin

ログメッセージ

mirror .org

変更サマリ

差分

--- /dev/null
+++ b/www.7-zip.org/recover.html
@@ -0,0 +1,334 @@
1+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2+<HTML>
3+<HEAD>
4+<META http-equiv="CONTENT-TYPE" content="TEXT/HTML; CHARSET=UTF-8">
5+<LINK href="style.css" rel="stylesheet" type="text/css">
6+<!-- HeadSubstituteBegin -->
7+<TITLE>How to recover corrupted 7z archive</TITLE>
8+<META name="keywords" content="7z, lzma, 7-zip, archiver, free, compression, zip,
9+best, compress, solid, high, ratio, unzip, far, win32, 7zip, long, file, names">
10+<!-- HeadSubstituteEnd -->
11+</HEAD>
12+<BODY>
13+
14+<!-- to page translators: this page describes some technical things and
15+can be changed several times in future. It can be difficult for you
16+to support updated version of translation. So don't translate it and
17+just link to this original English version of page -->
18+
19+<H1>How to recover corrupted 7z archive</H1>
20+
21+<H2>Try latest version of 7-Zip</H2>
22+
23+<P>It's possible that new version of 7-Zip can solve your problems with 7z archives.
24+So download latest version of 7-Zip and try to use that new version.
25+You can try also latest alpha or beta version.
26+If new version also doesn't help, read this manual.</P>
27+
28+<H2>Required software:</H2>
29+<UL>
30+ <LI>7-Zip (latest version, that can be stable, alpha or beta version).
31+ <LI>Some program with hex viewer or editor,
32+ for example, <A href="http://www.farmanager.com">FAR Manager</A>.
33+</UL>
34+
35+<H2>7z archive structure</H2>
36+
37+<P>7z archive consists of 4 main blocks of data:
38+<OL>
39+ <LI>Start Header (32 bytes): it contains signature and link to End Header
40+ <LI>Compressed Data of files
41+ <LI>Compressed Metadata Block for files: it contains links to Compressed Data, information about compression methods, CRC, file names, sizes, timestamps and so on.
42+ <LI>End Header: it contains link to Compressed Metadata Block.
43+</OL>
44+
45+Note: If 7z archive contains only one file without encryption,
46+ 7-Zip stores Metadata for that file in End Header in uncompressed form,
47+ and there are only 3 main blocks in that case.
48+
49+<H3>Archive example</H3>
50+
51+<P>Archive example: a.7z (3740 bytes) that contains 5 files compressed with LZMA method.
52+<P>Start of archive:</P>
53+<PRE>
54+0000000000: 37 7A BC AF 27 1C 00 04 5B 38 BE F9 59 0E 00 00
55+0000000010: 00 00 00 00 23 00 00 00 00 00 00 00 7A 63 68 FD
56+0000000020: 00 21 16 89 6C 71 3D AB 7D 89 E6 3C 2E BE 60 24
57+
58+00: 6 bytes: 37 7A BC AF 27 1C - Signature
59+06: 2 bytes: 00 04 - Format version
60+08: 4 bytes: 5B 38 BE F9 - CRC of the following 12 bytes
61+0C: 8 bytes: 59 0E 00 00 00 00 00 00 - relative offset of End Header
62+14: 8 bytes: 23 00 00 00 00 00 00 00 - the length of End Header
63+1C: 4 bytes: 7A 63 68 FD - CRC of the End Header
64+
65+Relative offset of End Header is relative from the end of Start Header,
66+that is at offset 0x20 (32 in decimal).
67+Real offset of End Header in example archive = 0x20 + 0x0E59 = 0x0E79
68+
69+20: 00 21 16 89 ... - start of compressed data.
70+ Note: if the file was compressed with LZMA method, the first byte
71+ is always 00. If first byte is not 00, then archive uses
72+ another method (it can be LZMA2 or encrypted data with AES).
73+</PRE>
74+
75+<P>End of archive:</P>
76+<PRE>
77+End Header (offset = 0x0E59, length = 0x23):
78+
79+0000000E70: 17 06 8D AD 01 09 80
80+0000000E80: AC 00 07 0B 01 00 01 23 03 01 01 05 5D 00 10 00
81+0000000E90: 00 0C 81 1A 0A 01 3C 70 52 F7 00 00
82+
83+Possible values for first byte in End Header:
84+ 17 - End Header contains the link to Metadata Block.
85+ 01 - Metadata block is stored in End Header.
86+</PRE>
87+
88+<H2>Corruption types</H2>
89+
90+<P>There are some possible cases when archive is corrupted:
91+<UL>
92+ <LI>You can open archive and you can see the list of files, but when you press
93+ Extract or Test command, there are some errors: Data Error or CRC Error.
94+ <LI>When you open archive, you get message "Can not open file 'a.7z' as archive"
95+</UL>
96+
97+<H2>Corruption case: Data errors or CRC errors for files inside archive</H2>
98+
99+<P>Here we describe the case, when you can open archive and you see the list of files,
100+but when you press Extract or Test command, there are some errors: Data Error or CRC Error.</P>
101+
102+<P>It's pretty difficult to recover data for that case.</P>
103+
104+<P>If archive was compressed in "Solid" mode, and you have exact copies of
105+some files from archive, you can create similar archive with good copies of
106+files with same settings and in same order, and replace "bad" parts of bad.7z
107+with "good" parts from another good.7z. You must look listings of files in bad and
108+good archives, logs of "test" command, and think about ways to replace bad parts.
109+
110+<P>The are no more instructions here for that corruption case.</P>
111+
112+<H2>Corruption case: Can not open file 'a.7z' as archive</H2>
113+
114+<P>If you try to open or extract archive and you see the message
115+"Can not open file 'a.7z' as archive", it means that 7-Zip can't open some
116+header from the start or from the end of archive.</P>
117+
118+<P>In that case you must open archive in hex editor and look to Start Header and End Header.</P>
119+
120+<P>Possible cases:</P>
121+
122+<UL>
123+
124+<LI>Case: If start of archive is corrupted, then there is no link to End Header.
125+ But if the End Header is OK, and the size of archive is also correct,
126+ you can replace data in Start Header in hex editor to the following values:
127+<PRE>
128+0000000000: 37 7A BC AF 27 1C 00 04 00 00 00 00 00 00 00 00
129+0000000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
130+</PRE>
131+
132+<P>Then try to open archive, if you can open and you see the list of files,
133+try Test or Extract command. Look also "Data errors or CRC errors" section in this page.</P>
134+
135+<LI>Case: Start Header and End Header are OK, but total size of archive is not OK.
136+You can calculate correct size of archive from values in Start Header.
137+Then you must recover correct size. You can insert some data or remove some data
138+somewhere in archive (for example, at offset of several MBs before the end of archive).
139+
140+<P>
141+For example, if you have multi-volume archive: a.7z.001, ... , a.7z.009,
142+but one part a.7z.008 is missing,
143+just copy a.7z.007 to file a.7z.008, and 7-Zip will see correct size of archive.
144+Or if some part was reduced, look the size of another parts and restore original (correct)
145+size of "bad" part, so total size will be correct again, and 7-zip will be able
146+to open headers.</P>
147+
148+<LI>Case: The end of archive is corrupted or missing. The following text describes that case.
149+
150+</UL>
151+
152+<H2>There is no correct End Header at the end of archive</H2>
153+
154+<P>7-Zip writes full Start Header only at the end of archive creation operation.</P>
155+
156+<P>You can look to Start Header. If you see signature with version and zeros in another fields:</P>
157+<PRE>
158+0000000000: 37 7A BC AF 27 1C 00 04 00 00 00 00 00 00 00 00
159+0000000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
160+</PRE>
161+<P>then archive creation operation probably was interrupted by some reason.
162+And in that case probably there are no Metadata Block and End Header at the end of archive.</P>
163+
164+<P>Note: If archive is multi-volume, uncompleted Start Header is also possible,
165+if first volume was copied before end of archive (last volume) was written.
166+In that case archive is not corrupted. And 7-Zip can unpack such archive, if total
167+size is correct and if there is correct End Header.</P>
168+
169+<P>If Start Header is OK, you can calculate correct archive size and compare with the size
170+of archive that you have.</P>
171+
172+<P>If there is no End Header, you can not recover file names, timestamps, and another metadata,
173+but probably it's possible to recover some data as raw file, and then it's possible to
174+recover data from raw file with some parser.</P>
175+
176+<P>We describe all steps with example:</P>
177+<OL>
178+ <LI> Create good 7z archive
179+ <LI> Corrupt archive
180+ <LI> Recover files from corrupted archive
181+</OL>
182+
183+<H2>Create good archive</H2>
184+
185+<P>We create some good archive. We use readme.txt (1565 bytes) form 7-Zip 9.20 as example file.</P>
186+<P> Create readme.txt.bz2, readme.zip, readme.txt.gzip and readme.txt.xz archives from readme.txt.<P>
187+<P> Create a.7z with LZMA method that contains all files:
188+<PRE>
189+ readme.txt.bz2
190+ readme.txt.gz
191+ readme.zip
192+ readme.txt
193+ readme.txt.xz
194+</PRE>
195+<P>We have a.7z (3740 bytes). You can look that file in hex editor.
196+It must have structure similar to structure of 7z file described above.</P>
197+
198+<H2>Corrupt archive</H2>
199+
200+<P>Now we currupt a.7z archive. We want to split archive into two parts:
201+<UL>
202+ <LI> a.7z.001: Start Header, some part of Compressed Data
203+ <LI> a.7z.002: Some part of Compressed Data, Metadata, End Header
204+</UL>
205+
206+<P>Metadata block with End Header are not big for our test archive (smaller than 300 bytes).</P>
207+
208+<P>We call "Split file..." command in 7-Zip File Manager and type "3000 100G" in "Split to volumes, bytes:" field (100G means that second part can not be larger than 100 GB).</P>
209+
210+<P>We have two parts: a.7z.001 (3000 bytes) and a.7z.002 (740 bytes).
211+Then we copy a.7z.001 to bad.7z and try to open bad.7z. And we get
212+the message "Can not open file 'bad.7z' as archive", so we have corrupted archive.</P>
213+
214+<H3>Recover archive</H3>
215+
216+<P>We open bad.7z in hex editor</P>
217+
218+<PRE>
219+0000000000: 37 7A BC AF 27 1C 00 04 5B 38 BE F9 59 0E 00 00
220+0000000010: 00 00 00 00 23 00 00 00 00 00 00 00 7A 63 68 FD
221+0000000020: 00 21 16 89 6C 71 3D AB 7D 89 E6 3C 2E BE 60 24
222+</PRE>
223+
224+<p>We see that Start Header is OK.</P>
225+<P>We calculate correct archive size from Start Header fields values:</P>
226+<P>0x0E59 + 0x20 + 0x23 = 0x0E9C = 3740</P>
227+<P>Correct size is 3740 bytes, but our "bad.7z" is only 3000 bytes.</P>
228+
229+<P>We look to the end of archive:</P>
230+<PRE>
231+0000000B60: 55 73 EA 87 45 18 FC AD 67 0D 40 EF F4 41 49 63
232+0000000B70: 6A 87 54 70 32 6C B0 8F 76 2A 63 BF 12 5D 88 CD
233+0000000B80: 22 76 9F 97 05 3B 37 BE 49 CD F8 0A CC 67 FB FE
234+0000000B90: 17 2E 16 D5 1F 8C 5A 30 08 7F C6 E9 98 9F 00 F1
235+0000000BA0: A6 99 F9 ED 01 62 84 48 77 69 C7 65 21 21 42 66
236+0000000BB0: 48 F1 FE 79 06 08 25 68
237+</PRE>
238+
239+<P>And we don't see End Header at the end of archive.</P>
240+
241+<P>Conclusion: archive probably was truncated.</P>
242+
243+<P>Now we want to create another "good" 7z archive that contains good Start Header, End Header.
244+and we want to place Compressed Data block from bad.7z inside that new "good" archive.</P>
245+
246+<P>At first we look start of Compressed Data block in bad.7z:</P>
247+<PRE>
248+0000000020: 00 21 16 89 6C 71 3D AB 7D 89 E6 3C 2E BE 60 24
249+</PRE>
250+
251+<P>If LZMA method was used, then first byte in compressed data is always 0 and
252+high bit of second byte is also 0. So if we see 00 in first byte and from 00 to 7F in second byte, probably LZMA method was used (not LZMA2).</P>
253+
254+<P>If first byte in compressed data is not 0 or if the value of second byte is higher
255+ then 7F, then it's not LZMA stream. It can be LZMA2 (or AES encrypted stream).</P>
256+
257+<P>We must create new "good" 7z archive with same method as in bad.7z, and new archive
258+must be much larger than bad.7z</P>
259+
260+<P>So we select some big file for that new archive. In some cases you can use even bad.7z as
261+that big file.
262+But we use 7-zip.chm. We rename 7-zip.chm (91020 bytes) to file raw.dat and we compress
263+raw.dat to raw.7z with LZMA method with big dictionary size value. The dictionary size
264+must be equal or larger than dictionary size in bad.7z.</P>
265+
266+<P>raw.7z is (84898 bytes) that is much larger than bad.7z, as required. if raw.7z
267+is smaller than "bad.7z", you must create another raw.7z with another raw.dat that is larger.</P>
268+
269+<P>We call "Split file..." function for bad.7z and type "32 100G" in "Split to volumes, bytes:" field.
270+<P>It creates 2 parts:</P>
271+<UL>
272+ <LI>bad.7z.001: 32 bytes : Start Header
273+ <LI>bad.7z.002: 2968 bytes : start of Compressed Data
274+</UL>
275+
276+<P>We call "Split file..." function for raw.7z and type "32 2968 100G" in "Split to volumes, bytes:" field. Note that the value 2968 is equal to size of "bad.7z.002". When you recover
277+real archive, you must use exact size of your bad.7z.002.</P>
278+
279+<P>It creates 3 parts:</P>
280+<UL>
281+ <LI>raw.7z.001: 32 bytes : Start Header
282+ <LI>raw.7z.002: 2968 bytes : start of Compressed Data
283+ <LI>raw.7z.003: 81898 bytes : end of Compressed Data, Metadata Block, End Header
284+</UL>
285+
286+<P>Then we rename bad.7z.002 file to raw.7z.002</P>
287+
288+<P>Now multi-volume "raw.7z.*" archive contains good headers from raw.7z and compressed data from "bad.7z"</P>
289+
290+<P>We press "Extact" for raw.7z.001 file. It will extract raw.dat file and probably it will show "Data Error" message.</P>
291+
292+<P>Now we have raw.dat file that contains recovered stream from bad.7z.</P>
293+
294+<P>Most of 7z archives are solid. If bad.7z archive was solid, then recovered stream
295+consists of concatenated original files</P>
296+
297+<P>If bad.7z archive is not solid, then recovered stream
298+contains data for one file. It can also contain some garbage data at the end.</P>
299+
300+<H2>Parsing raw stream for recovered solid archive</H2>
301+
302+<P>No we must use some parser software that will look raw.dat, search file
303+signatures and extract some files from that file.</P>
304+
305+<P>You can try to use parser from 7-Zip.</P>
306+
307+<P>You need 7-Zip 9.34 alpha or later version.</P>
308+
309+<P>Select raw.dat and call context menu command "7-Zip > Open Archive > #" </P>
310+<P>It shows:<P>
311+<PRE>
312+ 1.bz2
313+ 2.readme.txt.gz
314+ 3.zip
315+ 4
316+ 5.xz
317+</PRE>
318+
319+<P> Press Extract command to extract these files.</P>
320+
321+<P> So we have recovered some of the original files, but without original names.</P>
322+
323+<P> 7-Zip parser can find archives in raw file. But it doesn't recognize another files,
324+like xml, html, jpg, png files and so on.
325+So probably you need some another parser software to extract files from raw file.</P>
326+
327+<H2>Recovering non-solid archives and archives with multiple solid blocks</H2>
328+
329+<P>If there are more than one solid block in 7z archive, you must detect exact end of solid block, and start of next solid block.</P>
330+
331+<P>The recovering procedure for that case will be described in future</P>
332+
333+</BODY>
334+</HTML>
\ No newline at end of file
旧リポジトリブラウザで表示