blob: 1fe2e449fd691dbce0089709dfde48545c6f8edf [file] [log] [blame]
Steve Kondike68cb602016-08-28 00:45:36 -07001.\" Copyright (c) 2015 Jean-Pierre Andre
2.\" This file may be copied under the terms of the GNU Public License.
3.\"
4.TH NTFSRECOVER 8 "September 2015" "ntfs-3g @VERSION@"
5.SH NAME
6ntfsrecover \- Recover updates committed by Windows on an NTFS volume
7.SH SYNOPSIS
8\fBntfsrecover\fR [\fIoptions\fR] \fIdevice\fR
9.SH DESCRIPTION
10.B ntfsrecover
11applies to the metadata the updates which were requested on Windows but could
12not be completed because they were interrupted by some event such as a power
13failure, a hardware crash, a software crash or the device being unplugged.
14Doing so, the file system is restored to a consistent state, however updates
15to user data may still be lost.
16
17Updating the file system generally requires updating several records which
18should all be made for the file system to be kept consistent. For instance,
19creating a new file requires reserving an inode number (set a bit in a bit
20map), creating a file record (store the file name and file attributes), and
21registering the file in a directory (locate the file from some path). When an
22unfortunate event occurs, and one of these updates could be done but not all
23of them, the file system is left inconsistent.
24
25A group of updates which have all to be done to preserve consistency is
26called a transaction, and the end of updates within a transaction is called
27the commitment of the transaction.
28
29To protect from unfortunate events, Windows first logs in a special file all
30the metadata update requests without applying any, until the commitment is
31known. If the event occurs before the commitment, no update has been made and
32the file system is consistent. If the event occurs after the update, the log
33file can be analyzed later and the transactions which were committed can be
34executed again, thus restoring the integrity of the file system.
35
36.B ntfsrecover
37similarly examines the log file and applies the updates within committed
38transactions which could not be done by Windows.
39
40Currently, ntfs-3g does not log updates, so
41.B ntfsrecover
42cannot be used to restore consistency after an unfortunate event occurred
43while the file system was updated by Linux.
44
45.SH OPTIONS
46Below is a summary of all the options that
47.B ntfsrecover
48accepts. The normal usage is to use no option at all, as most of these
49options are oriented towards developers needs.
50
51Nearly all options have two equivalent names. The short name is
52preceded by
53.B \-
54and the long name is preceded by
55.BR \-\- .
56Any single letter options, that don't take an argument, can be combined into a
57single command, e.g.
58.B \-bv
59is equivalent to
60.BR "\-b \-v" .
61Long named options can be abbreviated to any unique prefix of their name.
62.TP
63\fB\-b\fR, \fB\-\-backward\fR
64Examine the actions described in the logfile backward from the latest one to
65the earliest one without applying any update. This may encompass records
66generated during several sessions, and when Windows is restarted, it often
67does not restart writing where it ended the previous session, so this leads
68to errors and bad sequencing when examining the full log file.
69.TP
70\fB\-c\fR, \fB\-\-clusters\fR \fBCLUSTER-RANGE\fR
71Restrict the output generated when using options -b -f -u -p
72to the actions operating on a cluster within the given cluster range.
73CLUSTER-RANGE is defined by the first and last cluster numbers separated
74by a hyphen, for instance 100-109 or 0x3e8-0x3ff. A single number means
75restricting to a single cluster. The first four log blocks have a special
76role and they are always shown.
77.TP
78\fB\-f\fR, \fB\-\-forward\fR \fBNUM\fR
79Examine the actions described in the logfile forward from the first one to
80the last one without applying any update. As the log file is reused
81circularly, the first one is generally not the earliest. Moreover when
82Windows is restarted, it often does not restart writing where it ended the
83previous sessions, and this leads to errors when examining a log file
84generated during several sessions.
85.TP
86\fB\-h\fR, \fB\-\-help\fR
87Show some help information.
88.TP
89\fB\-n\fR, \fB\-\-no-action\fR
90Do not apply any modification, useful when using the options -p, -s or -u.
91.TP
92\fB\-p\fR, \fB\-\-play\fR \fBCOUNT\fR
93Undo COUNT transaction sets and redo a single one, a transaction set being
94all transactions between two consecutive checkpoints. This is useful for
95replaying some transaction in the past. As a few actions are not undoable,
96this is not always possible.
97.TP
98\fB\-r\fR, \fB\-\-range\fR \fBBLOCK-RANGE\fR
99Examine the actions described in the logfile forward restricted to the
100requested log file block range without applying any update. The first four
101log blocks have a special role and they are always examined.
102.TP
103\fB\-s\fR, \fB\-\-sync\fR
104Sync the file system by applying the committed actions which have not
105been synced previously. This is the default option, used when none of
106the options -n, -f, -r, -p and -u are present.
107
108The option -s can be repeated to request applying the committed actions
109mentioned in the obsolete restart page. This is useful for testing the
110situations where the latest restart page cannot be read though it can
111actually be read.
112.TP
113\fB\-t\fR, \fB\-\-transactions\fR \fBCOUNT\fR
114Display the transaction parameters when examining the log file with one
115of the options --forward, --backward or --range.
116.TP
117\fB\-u\fR, \fB\-\-undo\fR \fBCOUNT\fR
118Undo COUNT transaction sets, thus resetting the file system to some
119checkpoint in the past, a transaction set being all transactions between
120two consecutive checkpoints. As a few actions are not undoable, this is
121not always possible.
122.TP
123\fB\-v\fR, \fB\-\-verbose\fR
124Display more debug/warning/error messages. This option may be used twice
125to display even more information.
126.TP
127\fB\-V\fR, \fB\-\-version\fR
128Show the version number, copyright and license of
129.BR ntfsrecover .
130.SH EXAMPLES
131Sync an NTFS volume on /dev/sda1.
132.RS
133.sp
134.B ntfsrecover -s /dev/sda1
135.sp
136.RE
137Display all actions which updated a cluster in range 100 to 119 :
138.RS
139.sp
140.B ntfsrecover --verbose --backward --clusters=100-119 /dev/sda1
141.sp
142.RE
143.SH BUGS
144If you find a bug please send an email describing the problem to the
145development team:
146.br
147.nh
148ntfs\-3g\-devel@lists.sf.net
149.hy
150.SH AUTHORS
151.B ntfsrecover
152was written by Jean-Pierre Andre
153.SH AVAILABILITY
154.B ntfsrecover
155is part of the
156.B ntfs-3g
157package and is available from:
158.br
159.nh
160http://www.tuxera.com/community/
161.hy
162.SH SEE ALSO
163.BR ntfs-3g (8),
164.BR ntfsfix (8),
165.BR ntfsprogs (8)