1ce5e5ac4SMatthew Dillon.\" Copyright (c) 2004,2005 The DragonFly Project. All rights reserved. 2ce5e5ac4SMatthew Dillon.\" 3ce5e5ac4SMatthew Dillon.\" This code is derived from software contributed to The DragonFly Project 4ce5e5ac4SMatthew Dillon.\" by Matthew Dillon <dillon@backplane.com> 5ce5e5ac4SMatthew Dillon.\" 6ce5e5ac4SMatthew Dillon.\" 7ce5e5ac4SMatthew Dillon.\" Redistribution and use in source and binary forms, with or without 8ce5e5ac4SMatthew Dillon.\" modification, are permitted provided that the following conditions 9ce5e5ac4SMatthew Dillon.\" are met: 10ce5e5ac4SMatthew Dillon.\" 11ce5e5ac4SMatthew Dillon.\" 1. Redistributions of source code must retain the above copyright 12ce5e5ac4SMatthew Dillon.\" notice, this list of conditions and the following disclaimer. 13ce5e5ac4SMatthew Dillon.\" 2. Redistributions in binary form must reproduce the above copyright 14ce5e5ac4SMatthew Dillon.\" notice, this list of conditions and the following disclaimer in 15ce5e5ac4SMatthew Dillon.\" the documentation and/or other materials provided with the 16ce5e5ac4SMatthew Dillon.\" distribution. 17ce5e5ac4SMatthew Dillon.\" 3. Neither the name of The DragonFly Project nor the names of its 18ce5e5ac4SMatthew Dillon.\" contributors may be used to endorse or promote products derived 19ce5e5ac4SMatthew Dillon.\" from this software without specific, prior written permission. 20ce5e5ac4SMatthew Dillon.\" 21ce5e5ac4SMatthew Dillon.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22ce5e5ac4SMatthew Dillon.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23ce5e5ac4SMatthew Dillon.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24ce5e5ac4SMatthew Dillon.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25ce5e5ac4SMatthew Dillon.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26ce5e5ac4SMatthew Dillon.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 27ce5e5ac4SMatthew Dillon.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28ce5e5ac4SMatthew Dillon.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 29ce5e5ac4SMatthew Dillon.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30ce5e5ac4SMatthew Dillon.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 31ce5e5ac4SMatthew Dillon.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32ce5e5ac4SMatthew Dillon.\" SUCH DAMAGE. 33ce5e5ac4SMatthew Dillon.\" 348360e2deSThomas Nikolajsen.Dd February 8, 2009 35ce5e5ac4SMatthew Dillon.Dt JSCAN 8 36ce5e5ac4SMatthew Dillon.Os 37ce5e5ac4SMatthew Dillon.Sh NAME 38ce5e5ac4SMatthew Dillon.Nm jscan 39ce5e5ac4SMatthew Dillon.Nd journal file processing program 40ce5e5ac4SMatthew Dillon.Sh SYNOPSIS 41ce5e5ac4SMatthew Dillon.Nm 428360e2deSThomas Nikolajsen.Op Fl 2dfuvF 43c2b2044aSMatthew Dillon.Op Fl c Ar count[k,m,g,t] 44c2b2044aSMatthew Dillon.Op Fl D Ar directory 45c2b2044aSMatthew Dillon.Op Fl m Ar mirror_transid_file/none 46c2b2044aSMatthew Dillon.Op Fl o/O Ar output_transid_file/none 47c2b2044aSMatthew Dillon.Op Fl s Ar size[k,m,g,t] 48c2b2044aSMatthew Dillon.Op Fl w/W Ar journal_prefix 49c2b2044aSMatthew Dillon.Op Ar journal_prefix/file 50ce5e5ac4SMatthew Dillon.Sh DESCRIPTION 51ce5e5ac4SMatthew DillonThe 52ce5e5ac4SMatthew Dillon.Nm 53c2b2044aSMatthew Dillonutility scans journal file or input stream for the purposes of debugging 54c2b2044aSMatthew Dillondumps, restoration, undo, mirroring, and other journaling features. 55ce5e5ac4SMatthew Dillon.Bl -tag -width indent 565adba82eSMatthew Dillon.It Fl 2 575adba82eSMatthew DillonImplement the full-duplex acknowledgement protocol on the input descriptor. 585adba82eSMatthew DillonNote that shell pipes are full-duplex and can be used with this option. 59c2b2044aSMatthew Dillon.It Fl c Ar count 60c2b2044aSMatthew DillonSpecify the number of transaction records which should be scanned, then exit. 61c2b2044aSMatthew DillonThis option is typically used along with 62c2b2044aSMatthew Dillon.Fl m 63c2b2044aSMatthew Dillonto limit the amount of work that 64c2b2044aSMatthew Dillon.Nm 65c2b2044aSMatthew Dillondoes, giving you the ability to incrementally run a mirror forwards or 66c2b2044aSMatthew Dillonbackwards. It is not usually used when piping in a live journal, but it 67c2b2044aSMatthew Dilloncan be. 68ce5e5ac4SMatthew Dillon.It Fl d 69c2b2044aSMatthew DillonDisplay the contents of the journaling file or stream in a human readable 70c2b2044aSMatthew Dillonformat on stderr. Note that stdout is used only for 71c2b2044aSMatthew Dillon.Fl o . 72cbeb73b9SMatthew Dillon.It Fl f 73cbeb73b9SMatthew Dillon.Nm 74cbeb73b9SMatthew Dillonwill sleep for 5 seconds and loop when it hits EOF on file or prefix 7523265324SSascha Wildnerset input rather than exit. This option is typically used when running 76cbeb73b9SMatthew Dillonon an input file or prefix set which is live (being written to by 77cbeb73b9SMatthew Dillonanother 78cbeb73b9SMatthew Dillon.Nm 79cbeb73b9SMatthew Dilloninstance). 80c2b2044aSMatthew Dillon.It Fl D Ar directory 81c2b2044aSMatthew DillonSpecify the base directory for the mirroring option. 82c2b2044aSMatthew Dillon.It Fl m Ar mirror_transid_file/none 83c2b2044aSMatthew DillonGenerate a mirror in the directory specified by 84c2b2044aSMatthew Dillon.Fl D 85c2b2044aSMatthew Dillonor, if not specified, the current directory. 86c2b2044aSMatthew DillonThe 87c2b2044aSMatthew Dillon.Ar mirror_transid_file 88c2b2044aSMatthew Dillonwill be used to track the transaction id representing the current 893f5e28f4SSascha Wildnersynchronization point for the mirror. The keyword 90c2b2044aSMatthew Dillon.Ar none 91c2b2044aSMatthew Dillonmay be specified if no tracking file is desired. However, if no tracking 92c2b2044aSMatthew Dillonfile is specified it will not be possible to roll the mirror forwards or 93c2b2044aSMatthew Dillonbackwards or restart the journaling stream being used to generate the mirror. 94c2b2044aSMatthew Dillon.Pp 95c2b2044aSMatthew DillonIt is important to note that journaling streams can contain meta-transactions 96c2b2044aSMatthew Dillonrepresenting huge, multi-gigabyte operations. If the journaling data is 97c2b2044aSMatthew Dillonnot being recorded to regular files via 98c2b2044aSMatthew Dillon.Fl w/W 99c2b2044aSMatthew Dillonit is possible that 100c2b2044aSMatthew Dillon.Nm 101c2b2044aSMatthew Dilloncould run itself out of memory trying to record the meta-transactions. 102c2b2044aSMatthew DillonIn addition, the mirror would not be restartable. If the journaling data 103c2b2044aSMatthew Dillonis being recorded via 104c2b2044aSMatthew Dillon.Fl w/W 105c2b2044aSMatthew Dillonand a mirroring transaction id file is being kept, the mirror can be 106c2b2044aSMatthew Dillonrestarted. 107c2b2044aSMatthew Dillon.Pp 108c2b2044aSMatthew DillonWhile it is possible to run a journaling stream directly into a mirror, 109c2b2044aSMatthew Dillonit is more typical to file the jornaling stream with 110c2b2044aSMatthew Dillon.Fl w 111c2b2044aSMatthew Dillonand catch the mirror up as a batch job with the journaling file set prefix 112c2b2044aSMatthew Dillonspecified as the input every so often. This way the system operator can 113c2b2044aSMatthew Dillonuse other 114c2b2044aSMatthew Dillon.Nm 115c2b2044aSMatthew Dilloncommands to, for example, run a mirror backwards and forwards in time. 116c2b2044aSMatthew Dillon.It Fl o/O Ar output_transid_file/none 117c2b2044aSMatthew DillonGenerate a journaling stream on stdout using the specified file to track 118c2b2044aSMatthew Dillonthe transaction id to help with restarts. 119c2b2044aSMatthew DillonThe 120c2b2044aSMatthew Dillon.Fl o 121c2b2044aSMatthew Dillonoption indicates a half-duplex output stream while the 122c2b2044aSMatthew Dillon.Fl O 123c2b2044aSMatthew Dillonoption indicates a full-duplex (ACK protocol) output stream. 124c2b2044aSMatthew Dillon.Pp 125c2b2044aSMatthew DillonThis option is not really designed to output to regular files because it 126c2b2044aSMatthew Dillondoes NOT necessarily weed out duplicate records. When both the input 127c2b2044aSMatthew Dillonstream and output stream are full-duplex and 128c2b2044aSMatthew Dillon.Fl w/W 129c2b2044aSMatthew Dillonis not specified, 130c2b2044aSMatthew Dillon.Nm 131c2b2044aSMatthew Dillonacts as a stateless transceiver and the input stream is not acked until 132c2b2044aSMatthew Dillonan ack is received from the output stream. 133c2b2044aSMatthew Dillon.Pp 1343f5e28f4SSascha WildnerThis option is most typically used in conjunction with 135c2b2044aSMatthew Dillon.Fl w/W . 13656be8454SSascha WildnerIn this case the ACK protocol is handled independently for the input side 137c2b2044aSMatthew Dillonand the output side uses the journaling data recorded by 138c2b2044aSMatthew Dillon.Fl w/W 139c2b2044aSMatthew Dillonas a buffer. 140c2b2044aSMatthew Dillon.Pp 141c2b2044aSMatthew DillonIn half-duplex output mode the output transaction id file is updated 142c2b2044aSMatthew Dillonafter a raw transaction record has been successfully written to stdout. 143c2b2044aSMatthew DillonIn full-duplex output mode the file is only updated with ACK data returned 144c2b2044aSMatthew Dillonon the stdout descriptor. 145c2b2044aSMatthew Dillon.Pp 146c2b2044aSMatthew DillonAs with the 147c2b2044aSMatthew Dillon.Fl m 148c2b2044aSMatthew Dillonoption, you can combine 149c2b2044aSMatthew Dillon.Fl o 150c2b2044aSMatthew Dillonin a journaling pipe with other options, but if you are trying to use it 151c2b2044aSMatthew Dillonas a buffer it may be better to have it separately pull its data off of 152c2b2044aSMatthew Dillona journaling file set generated via 153c2b2044aSMatthew Dillon.Fl w . 154c2b2044aSMatthew Dillon.It Fl s Ar size 155c2b2044aSMatthew DillonChange the size limit for rotating files created via 156c2b2044aSMatthew Dillon.Fl w . 157c2b2044aSMatthew DillonThe default is 100M. Values are in bytes or may be suffixed with k, 158c2b2044aSMatthew Dillonm, or g. 159c2b2044aSMatthew DillonIf a raw transaction causes the file's size limit to be exceeded, a new file 16016e9ff28SSascha Wildnerwill be created. If a raw transaction is, in-whole, larger than the file's 161c2b2044aSMatthew Dillonsize limit, the raw transaction will still be fully written to the file before 162c2b2044aSMatthew Dillona new file is created. Raw transactions are typically limited to the size 163c2b2044aSMatthew Dillonof the source system's memory FIFO. This option is typically used to size 164c2b2044aSMatthew Dillonjournaling files to fit onto the appropriate backup media or to provide 165d6416f24SSascha Wildnerbite-sized chunks for other programs to ingest. 166c2b2044aSMatthew Dillon.Pp 167c2b2044aSMatthew DillonWhen restarting a journal, a new sequence number will always be chosen for 168c2b2044aSMatthew Dillonthe resumption of data recording. No existing file will be appended to when 169c2b2044aSMatthew Dillon.Nm 170c2b2044aSMatthew Dillonis reinvoked. 171c2b2044aSMatthew Dillon.It Fl u 172c2b2044aSMatthew DillonWill cause the journal to be scanned backwards (requires seekable media). 173c2b2044aSMatthew DillonTransactions will be dumped in reverse order. If mirroring, the UNDO 174c2b2044aSMatthew Dillondata will be executed. If not specified, 1 hour's worth of data will be 175c2b2044aSMatthew Dillonundone. Can only be used with a journaling file or journaling prefix 176c2b2044aSMatthew Dillonas the input. 177bb406b71SMatthew Dillon.It Fl v 178bb406b71SMatthew DillonIncrease verbosity on stderr. This option is primarily used for debugging. 179c2b2044aSMatthew Dillon.It Fl w Ar prefix 180c2b2044aSMatthew DillonThe received journaling stream is recorded in journaling files named 181c2b2044aSMatthew Dillon.Ar <prefix>.<seq> 182c2b2044aSMatthew Dillonand the current transaction id is tracked in a file named 183c2b2044aSMatthew Dillon.Ar <prefix>.transid . 184c2b2044aSMatthew DillonA journaling file is closed out and a new file with the next sequence 185c2b2044aSMatthew Dillonnumber is created once the file surpasses 100MB. 186c2b2044aSMatthew Dillon.Pp 187c2b2044aSMatthew DillonThis option is robust across restarts. The current transaction id 188c2b2044aSMatthew Dillonwill be read and the input stream will be skipped until it is reached. 189c2b2044aSMatthew DillonIf the input is a journaling file or prefix set, 190c2b2044aSMatthew Dillon.Nm 191c2b2044aSMatthew Dillonwill be able to quickly seek to the restart point. 192c2b2044aSMatthew Dillon.Pp 193c2b2044aSMatthew DillonNOTE: If 194c2b2044aSMatthew Dillonyou are generating a mirror with the same command via 195c2b2044aSMatthew Dillon.Fl m , 19623265324SSascha Wildnerand the journaling data input is a stream rather than a file or prefix 197c2b2044aSMatthew Dillonset, you must use 198c2b2044aSMatthew Dillon.Fl w/W 199c2b2044aSMatthew Dillonif you want the mirror to be restartable. This is because while we can 200c2b2044aSMatthew Dillonpick up the transaction id where we left off, that raw transaction id may 201c2b2044aSMatthew Dillonhave cut a larger meta-transaction in half and the mirroring code will 202c2b2044aSMatthew Dillonnot be able to access the whole of the transaction unless it has a file 203c2b2044aSMatthew Dillonor prefix set to work with. 204c2b2044aSMatthew Dillon.It Fl W Ar prefix 205c2b2044aSMatthew DillonSimilar to 206c2b2044aSMatthew Dillon.Fl w 207c2b2044aSMatthew Dillonexcept that the journaling files created are strictly temporary and will 208c2b2044aSMatthew Dillonbe deleted once they exceed the size limit AND the related meta-transactions 209c2b2044aSMatthew Dillonhave been completed. 210c2b2044aSMatthew Dillon.Pp 211c2b2044aSMatthew DillonIf combined with 212c2b2044aSMatthew Dillon.Fl m , 213c2b2044aSMatthew Dillonthe meta-transactions are considered to be completed only when the mirror 214c2b2044aSMatthew Dillonfinishes executing them. It is possible for several sequence number files 215c2b2044aSMatthew Dillonto build if a particularly large meta-transaction is coming down the pipe. 216c2b2044aSMatthew Dillon.Pp 217c2b2044aSMatthew DillonIf combined with 218c2b2044aSMatthew Dillon.Fl o/O , 219c2b2044aSMatthew Dillonthe meta-transactions are considered to be completed when the data has 220c2b2044aSMatthew Dillonbeen successfully written out to the pipe in half duplex mode, or when 221c2b2044aSMatthew Dillonthe ACK has been received in full-duplex mode. 222c2b2044aSMatthew Dillon.Pp 223c2b2044aSMatthew DillonIf both 224c2b2044aSMatthew Dillon.Fl m 225c2b2044aSMatthew Dillonand 226c2b2044aSMatthew Dillon.Fl w/W 227c2b2044aSMatthew Dillonis used, the journaling data files are only deleted when both actions 228c2b2044aSMatthew Dillonno longer need the data. 229c2b2044aSMatthew Dillon.It Fl F 230c2b2044aSMatthew DillonForces 231c2b2044aSMatthew Dillon.Nm 2324041d919SSascha Wildnerto 2334041d919SSascha Wildner.Fn fsync 2344041d919SSascha Wildnerafter updating a journaling file prior to acknowledging the 235c2b2044aSMatthew Dillondata or updating a transaction-id-tracking file. If specified twice, 236c2b2044aSMatthew Dillon.Nm 2374041d919SSascha Wildnerwill also 2384041d919SSascha Wildner.Fn fsync 2394041d919SSascha Wildnerafter updating the transaction-id-tracking file. 240c2b2044aSMatthew Dillon.It Ar journal_prefix/file 24128feafc7SSascha WildnerSpecify the input to 24228feafc7SSascha Wildner.Nm . 24328feafc7SSascha WildnerThis can be a journaling file set prefix 244c2b2044aSMatthew Dillonor it can be a plain file. If no input file is specified, stdin is 245c2b2044aSMatthew Dillonassumed. Note that when generating a mirror from a stdin stream, the 246c2b2044aSMatthew Dillonmirror will not be restartable unless 247c2b2044aSMatthew Dillon.Fl w/W 248c2b2044aSMatthew Dillonis also used. 249ce5e5ac4SMatthew Dillon.El 250c2b2044aSMatthew Dillon.Sh OPERATIONAL NOTES 251c2b2044aSMatthew DillonIt is often important to be able to quickly stage journaled data through 252c2b2044aSMatthew Dillona dedicated backup machine on a LAN. There are several places where data 253c2b2044aSMatthew Dilloncan be buffered and staged out. 254c2b2044aSMatthew Dillon.Pp 255c2b2044aSMatthew DillonThe machine generating the journal typically buffers several megabytes of 256c2b2044aSMatthew Dillonjournal data in the kernel. This local machine can pipe that data to 257c2b2044aSMatthew Dillon.Nm 258c2b2044aSMatthew Dillonor some other locally run program to add another buffering stage, or you 259c2b2044aSMatthew Dilloncan directly attach a TCP connection to the kernel's journaling output. 260c2b2044aSMatthew Dillon.Pp 261c2b2044aSMatthew DillonThe LAN backup box typically buffers gigabytes worth of data by running 26228feafc7SSascha Wildnermultiple jscans. The 26328feafc7SSascha Wildner.Nm 26428feafc7SSascha Wildneron the receiving end of the TCP or pipe (for 265c2b2044aSMatthew Dillonexample, via ssh) typically records the data via the 266c2b2044aSMatthew Dillon.Fl w 267c2b2044aSMatthew Dillonoption, and then runs other 268c2b2044aSMatthew Dillon.Nm 269c2b2044aSMatthew Dillonprograms from scripts or cron to take that data and copy it to your 27028feafc7SSascha Wildneroff-site backup machine. Other 27128feafc7SSascha Wildner.Nm 27228feafc7SSascha Wildnerprograms may use the same data 273c2b2044aSMatthew Dillonset to generate mirrors or other backup streams. 274c2b2044aSMatthew Dillon.Pp 275c2b2044aSMatthew DillonIt should be noted that if 276c2b2044aSMatthew Dillon.Fl w/W 277c2b2044aSMatthew Dillonis specified, both mirroring mode and output mode will internally 278c2b2044aSMatthew Dillonfork the program once the appropriate synchronization point has been reached, 279c2b2044aSMatthew Dilloneffectively decoupling their operation, and read all of their data via 280c2b2044aSMatthew Dillonthe journaling files written out by the master program. In particular, 28168b2c890SSascha Wildnerblockages in the mirroring and output code will not affect our ability 282c2b2044aSMatthew Dillonto buffer the journaling input data via 283c2b2044aSMatthew Dillon.Fl w/W . 284c2b2044aSMatthew DillonIf 285c2b2044aSMatthew Dillon.Fl w/W 286c2b2044aSMatthew Dillonis not specified then neither the mirroring or output modes will fork. Under 28723265324SSascha Wildnerthese conditions, if the input is a stream rather than a file 288c2b2044aSMatthew Dillon.Nm 289c2b2044aSMatthew Dillonwill be forced to buffer meta-transactions (for mirroring) entirely in 290c2b2044aSMatthew Dillonmemory, which could present a serious problem since a single meta-transaction 2914041d919SSascha Wildnercan exceed a gigabyte (e.g. if someone were to do a single 2924041d919SSascha Wildner.Fn write 2934041d919SSascha Wildnersystem call writing a gigabyte all in one go). 294ce5e5ac4SMatthew Dillon.Sh SEE ALSO 295712e03b0SMatthew Dillon.Xr mountctl 8 296ce5e5ac4SMatthew Dillon.Sh HISTORY 297ce5e5ac4SMatthew DillonThe 298ce5e5ac4SMatthew Dillon.Nm 2994bb03b6eSJeroen Ruigrok/asmodaiutility first appeared in 3009feb902cSSascha Wildner.Dx 1.3 . 301*2d8ff97dSNuno Antunes.Sh CAVEATS 302*2d8ff97dSNuno AntunesThis utility is currently under construction and not all features have been 303*2d8ff97dSNuno Antunesimplemented yet. 304*2d8ff97dSNuno AntunesIn fact, most have not. 305