Remove redundant .Pp macros right before .El, .Sh and .Ss.
[dragonfly.git] / sbin / jscan / jscan.8
1 .\" Copyright (c) 2004,2005 The DragonFly Project.  All rights reserved.
2 .\"
3 .\" This code is derived from software contributed to The DragonFly Project
4 .\" by Matthew Dillon <dillon@backplane.com>
5 .\"
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\"
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in
15 .\"    the documentation and/or other materials provided with the
16 .\"    distribution.
17 .\" 3. Neither the name of The DragonFly Project nor the names of its
18 .\"    contributors may be used to endorse or promote products derived
19 .\"    from this software without specific, prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" SUCH DAMAGE.
33 .\"
34 .\" $DragonFly: src/sbin/jscan/jscan.8,v 1.10 2006/03/26 22:56:57 swildner Exp $
35 .\"
36 .Dd March 6, 2005
37 .Dt JSCAN 8
38 .Os
39 .Sh NAME
40 .Nm jscan
41 .Nd journal file processing program
42 .Sh SYNOPSIS
43 .Nm
44 .Fl 2dfuvF
45 .Op Fl c Ar count[k,m,g,t]
46 .Op Fl D Ar directory
47 .Op Fl m Ar mirror_transid_file/none
48 .Op Fl o/O Ar output_transid_file/none
49 .Op Fl s Ar size[k,m,g,t]
50 .Op Fl w/W Ar journal_prefix
51 .Op Ar journal_prefix/file
52 .Sh DESCRIPTION
53 The
54 .Nm
55 utility scans journal file or input stream for the purposes of debugging
56 dumps, restoration, undo, mirroring, and other journaling features.
57 .Bl -tag -width indent
58 .It Fl 2
59 Implement the full-duplex acknowledgement protocol on the input descriptor.
60 Note that shell pipes are full-duplex and can be used with this option.
61 .It Fl c Ar count
62 Specify the number of transaction records which should be scanned, then exit.
63 This option is typically used along with
64 .Fl m
65 to limit the amount of work that
66 .Nm
67 does, giving you the ability to incrementally run a mirror forwards or
68 backwards.  It is not usually used when piping in a live journal, but it
69 can be.
70 .It Fl d
71 Display the contents of the journaling file or stream in a human readable
72 format on stderr.  Note that stdout is used only for
73 .Fl o .
74 .It Fl f
75 .Nm
76 will sleep for 5 seconds and loop when it hits EOF on file or prefix
77 set input rather then exit.  This option is typically used when running
78 on an input file or prefix set which is live (being written to by
79 another
80 .Nm
81 instance).
82 .It Fl D Ar directory
83 Specify the base directory for the mirroring option.
84 .It Fl m Ar mirror_transid_file/none
85 Generate a mirror in the directory specified by
86 .Fl D
87 or, if not specified, the current directory.
88 The
89 .Ar mirror_transid_file
90 will be used to track the transaction id representing the current 
91 syncnronization point for the mirror.  The keyword
92 .Ar none
93 may be specified if no tracking file is desired.  However, if no tracking
94 file is specified it will not be possible to roll the mirror forwards or
95 backwards or restart the journaling stream being used to generate the mirror.
96 .Pp
97 It is important to note that journaling streams can contain meta-transactions
98 representing huge, multi-gigabyte operations.  If the journaling data is
99 not being recorded to regular files via
100 .Fl w/W
101 it is possible that
102 .Nm
103 could run itself out of memory trying to record the meta-transactions.
104 In addition, the mirror would not be restartable.  If the journaling data
105 is being recorded via
106 .Fl w/W
107 and a mirroring transaction id file is being kept, the mirror can be
108 restarted.
109 .Pp
110 While it is possible to run a journaling stream directly into a mirror,
111 it is more typical to file the jornaling stream with
112 .Fl w
113 and catch the mirror up as a batch job with the journaling file set prefix
114 specified as the input every so often.  This way the system operator can
115 use other
116 .Nm
117 commands to, for example, run a mirror backwards and forwards in time.
118 .It Fl o/O Ar output_transid_file/none
119 Generate a journaling stream on stdout using the specified file to track
120 the transaction id to help with restarts.
121 The
122 .Fl o
123 option indicates a half-duplex output stream while the
124 .Fl O
125 option indicates a full-duplex (ACK protocol) output stream.  
126 .Pp
127 This option is not really designed to output to regular files because it
128 does NOT necessarily weed out duplicate records.  When both the input
129 stream and output stream are full-duplex and
130 .Fl w/W
131 is not specified, 
132 .Nm
133 acts as a stateless transceiver and the input stream is not acked until
134 an ack is received from the output stream.
135 .Pp
136 This option is most typically used in conjuction with
137 .Fl w/W .
138 In this case the ACK protocol is handled independantly for the input side
139 and the output side uses the journaling data recorded by
140 .Fl w/W
141 as a buffer.
142 .Pp
143 In half-duplex output mode the output transaction id file is updated
144 after a raw transaction record has been successfully written to stdout.
145 In full-duplex output mode the file is only updated with ACK data returned
146 on the stdout descriptor.
147 .Pp
148 As with the
149 .Fl m
150 option, you can combine
151 .Fl o
152 in a journaling pipe with other options, but if you are trying to use it
153 as a buffer it may be better to have it separately pull its data off of
154 a journaling file set generated via
155 .Fl w .
156 .It Fl s Ar size
157 Change the size limit for rotating files created via
158 .Fl w .
159 The default is 100M.  Values are in bytes or may be suffixed with k,
160 m, or g.
161 If a raw transaction causes the file's size limit to be exceeded, a new file
162 will be created.  If a raw transaction is, in-whole, larger the the file's
163 size limit, the raw transaction will still be fully written to the file before
164 a new file is created.  Raw transactions are typically limited to the size
165 of the source system's memory FIFO.  This option is typically used to size
166 journaling files to fit onto the appropriate backup media or to provide
167 bite-sized chunks for other programs to injest.
168 .Pp
169 When restarting a journal, a new sequence number will always be chosen for
170 the resumption of data recording.  No existing file will be appended to when
171 .Nm
172 is reinvoked.
173 .It Fl u
174 Will cause the journal to be scanned backwards (requires seekable media).
175 Transactions will be dumped in reverse order.  If mirroring, the UNDO
176 data will be executed.  If not specified, 1 hour's worth of data will be
177 undone.  Can only be used with a journaling file or journaling prefix
178 as the input.
179 .It Fl v
180 Increase verbosity on stderr.  This option is primarily used for debugging.
181 .It Fl w Ar prefix
182 The received journaling stream is recorded in journaling files named
183 .Ar <prefix>.<seq>
184 and the current transaction id is tracked in a file named
185 .Ar <prefix>.transid .
186 A journaling file is closed out and a new file with the next sequence
187 number is created once the file surpasses 100MB. 
188 .Pp
189 This option is robust across restarts.  The current transaction id
190 will be read and the input stream will be skipped until it is reached.
191 If the input is a journaling file or prefix set,
192 .Nm
193 will be able to quickly seek to the restart point.
194 .Pp
195 NOTE: If
196 you are generating a mirror with the same command via
197 .Fl m ,
198 and the journaling data input is a stream rather then a file or prefix
199 set, you must use
200 .Fl w/W
201 if you want the mirror to be restartable.  This is because while we can
202 pick up the transaction id where we left off, that raw transaction id may
203 have cut a larger meta-transaction in half and the mirroring code will
204 not be able to access the whole of the transaction unless it has a file
205 or prefix set to work with.
206 .It Fl W Ar prefix
207 Similar to
208 .Fl w
209 except that the journaling files created are strictly temporary and will
210 be deleted once they exceed the size limit AND the related meta-transactions
211 have been completed. 
212 .Pp
213 If combined with
214 .Fl m ,
215 the meta-transactions are considered to be completed only when the mirror
216 finishes executing them.  It is possible for several sequence number files
217 to build if a particularly large meta-transaction is coming down the pipe.
218 .Pp
219 If combined with
220 .Fl o/O ,
221 the meta-transactions are considered to be completed when the data has 
222 been successfully written out to the pipe in half duplex mode, or when
223 the ACK has been received in full-duplex mode.
224 .Pp
225 If both
226 .Fl m
227 and
228 .Fl w/W
229 is used, the journaling data files are only deleted when both actions
230 no longer need the data.
231 .It Fl F
232 Forces
233 .Nm
234 to fsync() after updating a journaling file prior to acknowledging the
235 data or updating a transaction-id-tracking file.  If specified twice,
236 .Nm
237 will also fsync() after updating the transaction-id-tracking file.
238 .It Ar journal_prefix/file
239 Specify the input to jscan.  This can be a journaling file set prefix
240 or it can be a plain file.  If no input file is specified, stdin is
241 assumed.  Note that when generating a mirror from a stdin stream, the
242 mirror will not be restartable unless
243 .Fl w/W
244 is also used.
245 .El
246 .Sh OPERATIONAL NOTES
247 It is often important to be able to quickly stage journaled data through
248 a dedicated backup machine on a LAN.  There are several places where data
249 can be buffered and staged out.  
250 .Pp
251 The machine generating the journal typically buffers several megabytes of
252 journal data in the kernel.  This local machine can pipe that data to
253 .Nm
254 or some other locally run program to add another buffering stage, or you
255 can directly attach a TCP connection to the kernel's journaling output.
256 .Pp
257 The LAN backup box typically buffers gigabytes worth of data by running
258 multiple jscan's.  The jscan on the receiving end of the TCP or pipe (for
259 example, via ssh) typically records the data via the
260 .Fl w
261 option, and then runs other
262 .Nm
263 programs from scripts or cron to take that data and copy it to your
264 off-site backup machine.  Other jscan programs may use the same data
265 set to generate mirrors or other backup streams.  
266 .Pp
267 It should be noted that if
268 .Fl w/W
269 is specified, both mirroring mode and output mode will internally
270 fork the program once the appropriate synchronization point has been reached,
271 effectively decoupling their operation, and read all of their data via
272 the journaling files written out by the master program.  In particular,
273 blockages in the mirroring and output code will not effect our ability
274 to buffer the journaling input data via
275 .Fl w/W .
276 If
277 .Fl w/W
278 is not specified then neither the mirroring or output modes will fork.  Under
279 these conditions, if the input is a stream rather then a file
280 .Nm
281 will be forced to buffer meta-transactions (for mirroring) entirely in 
282 memory, which could present a serious problem since a single meta-transaction
283 can exceed a gigabyte (e.g. if someone were to do a single write() system
284 call writing a gigabyte all in one go).
285 .Sh SEE ALSO
286 .Xr mountctl 8
287 .Sh CAVEATS
288 This utility is currently under construction and not all features have been
289 implemented yet.
290 In fact, most have not.
291 .Sh HISTORY
292 The
293 .Nm
294 utility first appeared in
295 .Dx 1.3 .