Repository navigation
Expand file tree
/
Copy pathREADME
More file actions
345 lines (235 loc) · 11.8 KB
/
Copy pathREADME
File metadata and controls
345 lines (235 loc) · 11.8 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
NAME
hfsprescue - recover files from a HFS+ file system
SYNOPSIS
hfsprescue [-h|--help] [--version]
hfsprescue -s1 <device node|image file>
[-b <block size>]
[-o <offset in bytes>]
[-d <working / destination directory>]
[-f|--force]
hfsprescue -s2 [--utf8len <value 1 to 5>]
[--future-days <days>]
[-d <working directory>]
hfsprescue -s3 <device node|image file>
[-b <block size>]
[-o <offset in bytes>]
[-d <working directory>]
[--vh-file <file name>]
[--eof-file <file name>]
[-c <file number>]
[--file-list <file name>]
[--file-list-csv <file name>]
[--alternative]
[--ignore-blocks]
[--ignore-file-error]
hfsprescue -s4 [-d <working directory>]
hfsprescue -s5 [-d <working directory>]
hfsprescue -s6 [-d <working directory>] [-k]
hfsprescue --find <device node|image file>
[-ff <file> <num bytes>]
[-fs <string>]
[-o <offset in bytes>]
hfsprescue --list [--slash] [-d <working directory>]
hfsprescue --csv <file name> [--slash] [-d <working directory>]
hfsprescue --one-file <device node|image file> <file number>
[-b <block size>]
[-o <offset in bytes>]
[-d <working directory>]
[--vh-file <file name>]
[--eof-file <file name>]
[--alternative]
hfsprescue --find-eof
[-b <block size>]
[-o <offset in bytes>]
[--vh-file <file name>]
hfsprescue --extract-eof <device node|image file>
[ [--start-block <number>] < [--last-block <number>] | [--num-blocks <number>] > ]
[--eof-file <output file>]
[--vh-file <file name>]
hfsprescue --find-vh
[-o <offset in bytes>]
[--first]
[-f|--force]
[-v|--verbose]
hfsprescue --find-avh
[-o <offset in bytes>]
[--first]
[-f|--force]
[-v|--verbose]
hfsprescue --extract-vh <device node|image file> <LBA sector>
[--vh-file <output file>]
hfsprescue --remove-empty-dirs
[--dir <directory>]
[-f|--force]
DESCRIPTION
Hfsprescue scans a damaged image file or partition that is formatted with HFS+. You can restore your files and directories, even when it's not possible to mount it with your operating system. Your
files and directories will be stored in the directory './restored' in your current directory. The HFS+ file or partition will not be changed. So you need enough space to copy out the files from the
HFS+ file system. Hfsprescue supports HFS+ compression (resource fork).
You find a complete reference, depending on your installation, in '/usr/share/hfsprescue', '/usr/local/share/hfsprescue' or '/opt/share/hfsprescue' in English and German as HTML, PDF and TEXT.
RESTORING FILES
You have to complete 6 steps to restore your files:
1) Scan for your files.
hfsprescue -s1 <device node|image file>
[-b <block size>]
[-o <offset in bytes>]
[-d <working / destination directory>]
[-f|--force]
2) Cleanup file database.
hfsprescue -s2 [--utf8len <value 1 to 5>]
[--future-days <days>]
[-d <working directory>]
3) Restore your files.
hfsprescue -s3 <device node|image file>
[-b <block size>]
[-o <offset in bytes>]
[-d <working directory>]
[--vh-file <file name>]
[--eof-file <file name>]
[-c <file number>]
[--file-list <file name>]
[--alternative]
4) Restore your directory structure.
hfsprescue -s4 [-d <working directory>]
5) Move the restored files to the correct directories.
hfsprescue -s5 [-d <working directory>]
6) Last step, finalize and cleanup.
hfsprescue -s6 [-d <working directory>] [-k]
Hfsprescue will guide you through every step and is telling you the command for the next step.
Additional features
o Search Unicode string (useful on damaged/lost partition table).
o Search bytes from a file (useful on damaged/lost partition table).
o List files that have been found.
o CSV export of the list of files that have been found.
o Recover one file instead of all files.
o Recover files from a list.
o Find possible positions of the Extents Overflow File.
o Extract the Extents Overflow File.
o Find HFS+ Volume Header and partition start.
o Find HFS+ Alternate Volume Header.
o Extract a HFS+ Volume Header.
o Remove empty directories.
OPTIONS
-h, --help
Display help and exit.
o STEP 1: Scan for your files.
-s1 <device node|image file>
Run step 1. You have to tell the device node or image file.
-b <block size>
Set the block size in bytes. Useful when the boot sector has been lost.
-f, --force
Overwrite current log files.
-o <offset>
Set the start offset of the partition in bytes. Useful when the partition table is lost or damaged.
-d <working / destination directory>
Use the directory instead of the current working directory.
o STEP 2: Cleanup file database.
-s2 Run step 2.
--utf8len <value 1 to 5>
Set the allowed maximum char length of an UTF-8 char. File names that have invlaid chars will be removed. Values from 1 to 5 are allowed. 1 is the default value and should be fine. For file names with asian chars use 2. The values 3-5 shou
--future-days <days>
Set the allowed tollerance for future file dates. The default value is 7 days. Files with a date more in the future will be removed. Usually, those files are false detection.
-d <working directory>
Use the directory instead of the current working directory.
o STEP 3: Restore your files.
-s3 <device node|image file>
Run step 3. You have to tell the device node or image file.
-b <block size>
Set the block size in bytes. Useful when the boot sector has been lost.
-c <file number>
Continue the file restore and skip the files before <file number>.
-o <offset>
Set the start offset of the partition in bytes. Useful when the partition table is lost or damaged.
-d <working directory>
Use the directory instead of the current working directory.
--alternative
Find a new name when the file already exists in it's directory. Can happen with older versions or deleted files.
o STEP 4: Restore your directory structure.
-s4 Run step 4.
-d <working directory>
Use the directory instead of the current working directory.
o STEP 5: Move the restored files to the correct directories.
-s5 Run step 5.
-d <working directory>
Use the directory instead of the current working directory.
o STEP 6: Last step, finalize and cleanup.
-s6 Run step 6.
-k Keep mkdir.sh and hfsprescue_dir_id.tmp files.
-d <working directory>
Use the directory instead of the current working directory.
o FIND FILE BYTES AND/OR AN UNICODE STRING: Find data on sectors.
--find <device node|image file>
Find data. You have to tell the device node or image file.
-ff <file> <num bytes>
Find number of bytes from a file.
-fs <string>
Find a given string. The string will be converted to Unicode.
-o <offset in bytes>
Start search from offset.
o LIST FILES: List found files.
--list
This parameter lists all files that have been found. You can run this after you completed Step 2.
--slash
Mac OS X allows the char '/' in file names in the GUI. For directory compatibility, '/' is converted to ':'. Use --slash when you want to display the '/' in the file name instead of ':'. Maybe
when you search a file name which has '/'.
-d <working directory>
Use the directory instead of the current working directory.
o CSV EXPORT OF FILE LIST: Export list to a CSV file.
--csv
Export the file list to a CSV file. You can run this after you completed Step 2.
--slash
Mac OS X allows the char '/' in file names in the GUI. For directory compatibility, '/' is converted to ':'. Use --slash when you want to export the '/' in the file name instead of ':'.
-d <working directory>
Use the directory instead of the current working directory.
o RESTORE ONE FILE: Restore just one file instead of all files that have been found. You can run this after you completed Step 2.
--one-file <device node|image file> <file number>
You have to tell the device node or image file and the file number of the requested file. Both parameters are required.
-b <block size>
Set the block size in bytes. Useful when the boot sector has been lost.
-o <offset>
Set the start offset of the partition in bytes. Useful when the partition table is lost or damaged.
-d <working directory>
Use the directory instead of the current working directory.
--alternative
Find a new name when the file already exists in it's directory. Can happen with older versions or deleted files.
o FIND EXTENTS OVERFLOW FILE: Scan the device for possible start blocks.
--find-eof <device node|image file>
You have to tell the device node or image file.
-b <block size>
Set the block size in bytes. Useful when the boot sector has been lost.
-o <offset>
Set the start offset of the partition in bytes. Useful when the partition table is lost or damaged.
o FIND HFS+ VOLUME HEADER: Scan the device for possible Volume Headers and shows the start of the partition.
--find-vh <device node|image file>
You have to tell the device node or image file.
-o <offset in bytes>
Start search from offset.
--first
Just show the first HFS+ Volume Header and quit.
-f, --force
Show Volume Header even when the lastMountVersion field reports another OS than Mac OS X or Linux.
-v, --verbose
Display detailed informations.
EXAMPLE RESTORE COMMAND SEQUENCE
There are 6 Steps to complete.
hfsprescue -s1 /dev/sdb2
hfsprescue -s2 /dev/sdb2
hfsprescue -s3 /dev/sdb2
hfsprescue -s4
hfsprescue -s5
hfsprescue -s6
PARTITION START OFFSET CALCULATION FORMULA
You find a detailed description with an example on https://www.plop.at or in the hfsprescue.txt and hfsprescue.pdf
offset = byte_search_result - list_start_block * block_size
o Note:
Use --list to get the file start block (list_start_block) of the requested file.
Example: hfsprescue --list|grep PerfectPicture.jpg
Use --find and -ff to search for the reference file and get the byte_search_result value.
Example hfsprescue --find /dev/sdb -ff PerfectPicture.jpg 2000
SEE ALSO
hfsprescue.txt hfsprescue.pdf https://www.plop.at
BUGS
Unicode to UTF-8 conversion is not fully supported. There are problems with accents on non Mac OS X systems. When you restore on another system than Mac OS X, then the accents should be corrected when
you copy the restored files to a HFS+ file system.
This bug will be fixed maybe in a further version.
AUTHOR
Elmar Hanlhofer (office@plop.at) https://www.plop.at