http://linux-ntfs.sourceforge.net/snapshots/ntfsprogs-200309071734.tar.bz2
[ntfsprogs.git] / ntfsprogs / ntfsundelete.8.in
1 .\" Copyright (c) 2002 Richard Russon. All Rights Reserved.
2 .\" This file may be copied under the terms of the GNU Public License.
3 .\"
4 .TH NTFSUNDELETE 8 "June 2002" "Linux\-NTFS version @VERSION@"
5 .SH NAME
6 ntfsundelete \- recover a deleted file from an NTFS volume.
7 .SH SYNOPSIS
8 .B ntfsundelete
9 [
10 .I options
11 ]
12 .B device
13 .SH DESCRIPTION
14 .B ntfsundelete
15 has three modes of operation:
16 .IR scan ,
17 .I undelete
18 and
19 .IR copy .
20 .SS Scan
21 .PP
22 The default mode,
23 .I scan
24 simply reads an NTFS Volume and looks for files that have been deleted.  Then it
25 will print a list giving the inode number, name and size.
26 .SS Undelete
27 .PP
28 The
29 .I undelete
30 mode takes the inode and recovers as much of the data as possible.  It saves the
31 result to another location.  Partly for safety, but mostly because NTFS write
32 support isn't finished.
33 .SS Copy
34 .PP
35 This is a wizard's option.  It will save a portion of the MFT to a file.  This
36 probably only be useful when debugging
37 .I ntfsundelete
38 .SS Notes
39 .B ntfsundelete
40 only ever
41 .B reads
42 from the NTFS Volume.
43 .B ntfsundelete
44 will never change the volume.
45 .SH CAVEATS
46 .SS Miracles
47 .B ntfsundelete
48 cannot perform the impossible.
49 .PP
50 When a file is deleted the MFT Record is marked as not in use and the bitmap
51 representing the disk usage is updated.  If the power isn't turned off
52 immediately, the free space, where the file used to live, may become
53 overwritten.  Worse, the MFT Record may be reused for another file.  If this
54 happens it is impossible to tell where the file was on disk.
55 .PP
56 Even if all the clusters of a file are not in use, there is no guarantee that
57 they haven't been overwritten by some short\-lived file.
58 .SS Locale
59 In NTFS all the filenames are stored as Unicode.  They will be converted into
60 the current locale for display by
61 .BR ntfsundelete .
62 The utility has successfully displayed some Chinese pictogram filenames and then
63 correctly recovered them.
64 .SS Extended MFT Records
65 In rare circumstances, a single MFT Record will not be large enough to hold the
66 metadata describing a file (a file would have to be in hundreds of fragments
67 for this to happen).  In these cases one MFT record may hold the filename, but
68 another will hold the information about the data.
69 .B ntfsundelete
70 will not try and piece together such records.  It will simply show unnamed files
71 with data.
72 .SS Compressed and Encrypted Files
73 .B ntfsundelete
74 cannot recover compressed or encrypted files.  When scanning for them, it will
75 display as being 0% recoverable.
76 .SS The Recovered File's Size and Date
77 To recover a file
78 .B ntfsundelete
79 has to read the file's metadata.  Unfortunately, this isn't always intact.
80 When a file is deleted, the metadata can be left in an inconsistant state. e.g.
81 the file size may be zero; the dates of the file may be set to the time it was
82 deleted, or random.
83 .br
84 To be safe
85 .B ntfsundelete
86 will pick the largest file size it finds and write that to disk.  It will also
87 try and set the file's date to the last modified date.  This date may be the
88 correct last modified date, or something unexpected.
89 .SH OPTIONS
90 Below is a summary of all the options that
91 .B ntfsundelete
92 accepts.  All options have two equivalent names.  The short name is preceded by
93 .BR \-
94 and the long name is preceded by
95 .BR \-\- .
96 Any single letter options, that don't take an argument, can be combined into a
97 single command, e.g.
98 .BR \-fv
99 is equivalent to
100 .BR "\-f \-v" .
101 Long named options can be abbreviated to any unique prefix of their name.
102 .TP
103 .BI "\-b " num
104 .br
105 .ns
106 .TP
107 .BI "\-\-byte " num
108 If any clusters of the file cannot be recovered, the missing parts will be
109 filled with this byte.  The default is zeros.
110 .TP
111 .B \-C
112 .br
113 .ns
114 .TP
115 .B \-\-case
116 When scanning an NTFS volume, any filename matching (using the
117 .B \-\-match
118 option) is case\-insensitive.  This option makes the maching case\-sensitive.
119 .TP
120 .BI "\-c " range
121 .br
122 .ns
123 .TP
124 .BI "\-\-copy " range
125 This wizard's option will write a block of MFT FILE records to a file.  The
126 default file is
127 .I mft
128 which will be created in the current directory.  This option can be combined
129 with the
130 .B \-\-output
131 and
132 .B \-\-destination
133 options.
134 .TP
135 .BI "\-d " dir
136 .br
137 .ns
138 .TP
139 .BI "\-\-destination " dir
140 This option controls where to put the output file of the
141 .B \-\-undelete
142 and
143 .B \-\-copy
144 options.
145 .TP
146 .B \-f
147 .br
148 .ns
149 .TP
150 .B \-\-force
151 This will override some sensible defaults, such as not overwriting an existing
152 file.  Use this option with caution.
153 .TP
154 .B \-h
155 .br
156 .ns
157 .TP
158 .B \-\-help
159 Show a list of options with a brief description of each one.
160 .TP
161 .BI "\-m " pattern
162 .br
163 .ns
164 .TP
165 .BI "\-\-match " pattern
166 Filter the output of the
167 .B \-\-scan
168 option, by only looking for matching filenames.  The pattern can include the
169 wildcards '?', match exactly one character or '*', match zero or more
170 characters.  By default the matching is case\-insensitive.  To make the search
171 case sensitive, use the
172 .B \-\-case
173 option.
174 .TP
175 .BI "\-o " file
176 .br
177 .ns
178 .TP
179 .BI "\-\-output " file
180 Use this option to set name of output file that
181 .B \-\-undelete
182 or
183 .B \-\-copy
184 will create.
185 .TP
186 .BI "\-p " num
187 .br
188 .ns
189 .TP
190 .BI "\-\-percentage " num
191 Filter the output of the
192 .B \-\-scan
193 option, by only matching files with a certain amount of recoverable content.
194 .B Please read the caveats section for more details.
195 .TP
196 .BI \-q
197 .br
198 .ns
199 .TP
200 .BI \-\-quiet
201 Reduce the amount of output to a minimum.  Naturally, it doesn't make sense to
202 combine this option with
203 .BR \-\-scan .
204 .TP
205 .B \-s
206 .br
207 .ns
208 .TP
209 .B \-\-scan
210 Search through an NTFS volume and print a list of files that could be recovered.
211 This is the default action of
212 .BR ntfsundelete .
213 This list can be filtered by filename, size, percentage recoverable or last
214 modification time, using the
215 .BR \-\-match ,
216 .BR \-\-size ,
217 .B \-\-percent
218 and
219 .B \-\-time
220 options, respectively.
221 .sp
222 The output of scan will be:
223 .sp
224 .nf
225 Inode  Flags  %age     Date      Size  Filename
226  6038  FN..    93%  2002-07-17  26629  thesis.doc
227 .fi
228 .TS
229 lB lB
230 l l.
231 Flag    Description
232 F/D     File/Directory
233 N/R     (Non-)Resident data stream
234 C/E     Compressed/Encrypted data stream
235 !       Missing attributes
236 .TE
237 .RS
238 .sp
239 .br
240 The percentage field shows how much of the file can potentially be recovered.
241 .sp
242 .br
243 .RE
244 .BI "\-S " range
245 .br
246 .ns
247 .TP
248 .BI "\-\-size " range
249 Filter the output of the
250 .B \-\-scan
251 option, by looking for a particular range of file sizes.  The range may be
252 specified as two numbers separated by a '\-'.  The sizes may be abbreviated
253 using the suffixes k, m, g, t, for kilobytes, megabytes, gigabytes and terabytes
254 respectively.
255 .TP
256 .BI "\-t " since
257 .br
258 .ns
259 .TP
260 .BI "\-\-time " since
261 Filter the output of the
262 .B \-\-scan
263 option.  Only match files that have been altered since this time.  The time must
264 be given as number using a suffix of d, w, m, y for days, weeks, months or years
265 ago.
266 .TP
267 .BI "\-u " num
268 .br
269 .ns
270 .TP
271 .BI "\-\-undelete " num
272 Recover the file with this inode number.  This option can be combined with
273 .BR \-\-output ,
274 .BR \-\-destination ,
275 and
276 .BR \-\-byte .
277 .sp
278 When the file is recovered it will be given its original name, unless the
279 .B "\-\-output"
280 option is used.
281 .TP
282 .B \-v
283 .br
284 .ns
285 .TP
286 .B \-\-verbose
287 Increase the amount of output that
288 .B ntfsundelete
289 prints.
290 .TP
291 .B \-V
292 .br
293 .ns
294 .TP
295 .B \-\-version
296 Show the version number, copyright and license
297 .BR ntfsundelete .
298 .SH EXAMPLES
299 Look for deleted files on /dev/hda1.
300 .RS
301 .sp
302 .B ntfsundelete /dev/hda1
303 .sp
304 .RE
305 Look for deleted documents on /dev/hda1.
306 .RS
307 .sp
308 .B ntfsundelete /dev/hda1 -s \-m '*.doc'
309 .sp
310 .RE
311 Look for deleted files between 5000 and 6000000 bytes, with at least 90% of the
312 data recoverable, on /dev/hda1.
313 .RS
314 .sp
315 .B ntfsundelete /dev/hda1 \-S 5k\-6m \-p 90
316 .sp
317 .RE
318 Look for deleted files altered in the last two days
319 .RS
320 .sp
321 .B ntfsundelete /dev/hda1 \-t 2d
322 .sp
323 .RE
324 Undelete inode number 3689, call the file 'work.doc' and put it in the user's
325 home directory.
326 .RS
327 .sp
328 .B ntfsundelete /dev/hda1 \-u 3689 \-o work.doc \-d ~
329 .sp
330 .RE
331 Save MFT Records 3689 to 3690 to a file 'debug'
332 .RS
333 .sp
334 .B ntfsundelete /dev/hda1 \-c 3689\-3690 \-o debug
335 .RE
336 .SH BUGS
337 There are some small limitations to this program, but currently no known bugs.
338 If you find one, please send an email to
339 .nh
340 <linux-ntfs-dev@lists.sf.net>
341 .hy
342 .SH AUTHOR
343 .B ntfsundelete
344 was written by Richard Russon (FlatCap) <ntfs@flatcap.org>
345 .br
346 If you find this tool useful, make FlatCap happy and send him an email.
347 .SH AVAILABILITY
348 .B ntfsundelete
349 is part of the linux\-ntfs package and is available from
350 .br
351 .nh
352 http://linux\-ntfs.sourceforge.net/downloads.html
353 .hy
354 .SH SEE ALSO
355 .BR ntfsinfo (8),
356 .BR ntfsprogs (8)
357