1 .\" Copyright (c) 2002\-2005 Richard Russon.
2 .\" This file may be copied under the terms of the GNU Public License.
4 .TH NTFSUNDELETE 8 "November 2005" "ntfs-3g @VERSION@"
6 ntfsundelete \- recover a deleted file from an NTFS volume.
9 [\fIoptions\fR] \fIdevice\fR
12 has three modes of operation:
21 simply reads an NTFS Volume and looks for files that have been deleted. Then it
22 will print a list giving the inode number, name and size.
27 mode takes the files either matching the regular expression (option \-m)
28 or specified by the inode\-expressions and recovers as much of the data
29 as possible. It saves the result to another location. Partly for
30 safety, but mostly because NTFS write support isn't finished.
33 This is a wizard's option. It will save a portion of the MFT to a file. This
34 probably only be useful when debugging
42 will never change the volume.
46 cannot perform the impossible.
48 When a file is deleted the MFT Record is marked as not in use and the bitmap
49 representing the disk usage is updated. If the power isn't turned off
50 immediately, the free space, where the file used to live, may become
51 overwritten. Worse, the MFT Record may be reused for another file. If this
52 happens it is impossible to tell where the file was on disk.
54 Even if all the clusters of a file are not in use, there is no guarantee that
55 they haven't been overwritten by some short\-lived file.
57 In NTFS all the filenames are stored as Unicode. They will be converted into
58 the current locale for display by
60 The utility has successfully displayed some Chinese pictogram filenames and then
61 correctly recovered them.
62 .SS Extended MFT Records
63 In rare circumstances, a single MFT Record will not be large enough to hold the
64 metadata describing a file (a file would have to be in hundreds of fragments
65 for this to happen). In these cases one MFT record may hold the filename, but
66 another will hold the information about the data.
68 will not try and piece together such records. It will simply show unnamed files
70 .SS Compressed and Encrypted Files
72 cannot recover compressed or encrypted files. When scanning for them, it will
73 display as being 0% recoverable.
74 .SS The Recovered File's Size and Date
77 has to read the file's metadata. Unfortunately, this isn't always intact.
78 When a file is deleted, the metadata can be left in an inconsistent state. e.g.
79 the file size may be zero; the dates of the file may be set to the time it was
84 will pick the largest file size it finds and write that to disk. It will also
85 try and set the file's date to the last modified date. This date may be the
86 correct last modified date, or something unexpected.
88 Below is a summary of all the options that
90 accepts. Nearly all options have two equivalent names. The short name is
93 and the long name is preceded by
95 Any single letter options, that don't take an argument, can be combined into a
100 Long named options can be abbreviated to any unique prefix of their name.
102 \fB\-b\fR, \fB\-\-byte\fR NUM
103 If any clusters of the file cannot be recovered, the missing parts will be
104 filled with this byte. The default is zeros.
106 \fB\-C\fR, \fB\-\-case\fR
107 When scanning an NTFS volume, any filename matching (using the
109 option) is case\-insensitive. This option makes the matching case\-sensitive.
111 \fB\-c\fR, \fB\-\-copy\fR RANGE
112 This wizard's option will write a block of MFT FILE records to a file. The
115 which will be created in the current directory. This option can be combined
122 \fB\-d\fR, \fB\-\-destination\fR DIR
123 This option controls where to put the output file of the
129 \fB\-f\fR, \fB\-\-force\fR
130 This will override some sensible defaults, such as not overwriting an existing
131 file. Use this option with caution.
133 \fB\-h\fR, \fB\-\-help\fR
134 Show a list of options with a brief description of each one.
136 \fB\-i\fR, \fB\-\-inodes\fR RANGE
137 Recover the files with these inode numbers.
139 can be a single inode number, several numbers separated by commas "," or a
140 range separated by a dash "\-".
142 \fB\-m\fR, \fB\-\-match\fR PATTERN
143 Filter the output by only looking for matching filenames. The pattern can
144 include the wildcards '?', match exactly one character or '*', match zero or
145 more characters. By default the matching is case\-insensitive. To make the
146 search case sensitive, use the
150 \fB\-O\fR, \fB\-\-optimistic\fR
151 Recover parts of the file even if they are currently marked as in use.
153 \fB\-o\fR, \fB\-\-output\fR FILE
154 Use this option to set name of output file that
160 \fB\-P\fR, \fB\-\-parent\fR
161 Display the parent directory of a deleted file.
163 \fB\-p\fR, \fB\-\-percentage\fR NUM
164 Filter the output of the
166 option, by only matching files with a certain amount of recoverable content.
167 .B Please read the caveats section for more details.
169 \fB\-q\fR, \fB\-\-quiet\fR
170 Reduce the amount of output to a minimum. Naturally, it doesn't make sense to
171 combine this option with
174 \fB\-s\fR, \fB\-\-scan\fR
175 Search through an NTFS volume and print a list of files that could be recovered.
176 This is the default action of
178 This list can be filtered by filename, size, percentage recoverable or last
179 modification time, using the
185 options, respectively.
187 The output of scan will be:
190 Inode Flags %age Date Size Filename
191 6038 FN.. 93% 2002\-07\-17 26629 thesis.doc
199 N/R (Non\-)Resident data stream
200 C/E Compressed/Encrypted data stream
205 The percentage field shows how much of the file can potentially be recovered.
207 \fB\-S\fR, \fB\-\-size\fR RANGE
208 Filter the output of the
210 option, by looking for a particular range of file sizes. The range may be
211 specified as two numbers separated by a '\-'. The sizes may be abbreviated
212 using the suffixes k, m, g, t, for kilobytes, megabytes, gigabytes and terabytes
215 \fB\-t\fR, \fB\-\-time\fR SINCE
216 Filter the output of the
218 option. Only match files that have been altered since this time. The time must
219 be given as number using a suffix of d, w, m, y for days, weeks, months or years
222 \fB\-T\fR, \fB\-\-truncate\fR
225 is confident about the size of a deleted file, then it will restore the file to
226 exactly that size. The default behaviour is to round up the size to the nearest
227 cluster (which will be a multiple of 512 bytes).
229 \fB\-u\fR, \fB\-\-undelete\fR
232 mode. You can specify the files to be recovered using by using
236 options. This option can be combined with
238 .BR \-\-destination ,
242 When the file is recovered it will be given its original name, unless the
246 \fB\-v\fR, \fB\-\-verbose\fR
247 Increase the amount of output that
251 \fB\-V\fR, \fB\-\-version\fR
252 Show the version number, copyright and license for
255 Look for deleted files on /dev/hda1.
258 .B ntfsundelete /dev/hda1
261 Look for deleted documents on /dev/hda1.
264 .B ntfsundelete /dev/hda1 \-s \-m '*.doc'
267 Look for deleted files between 5000 and 6000000 bytes, with at least 90% of the
268 data recoverable, on /dev/hda1.
271 .B ntfsundelete /dev/hda1 \-S 5k\-6m \-p 90
274 Look for deleted files altered in the last two days
277 .B ntfsundelete /dev/hda1 \-t 2d
280 Undelete inodes 2, 5 and 100 to 131 of device /dev/sda1
283 .B ntfsundelete /dev/sda1 \-u \-i 2,5,100\-131
286 Undelete inode number 3689, call the file 'work.doc' and put it in the user's
290 .B ntfsundelete /dev/hda1 \-u \-i 3689 \-o work.doc \-d ~
293 Save MFT Records 3689 to 3690 to a file 'debug'
296 .B ntfsundelete /dev/hda1 \-c 3689\-3690 \-o debug
300 There are some small limitations to
302 but currently no known bugs. If you find a bug please send an email describing
303 the problem to the development team:
306 ntfs\-3g\-devel@lists.sf.net
310 was written by Richard Russon and Holger Ohmacht, with contributions from Anton
312 It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
317 package and is available from:
320 http://www.tuxera.com/community/