Imported Upstream version 2.5.2
[debian/dds2tar] / dds2tar.man
1 .TH dds2tar 1L 2.3 \" -*- nroff -*-
2 .SH NAME
3 dds2tar \- tool for fast tape access
4 .SH SYNOPSIS
5 .B dds2tar
6 [
7 .B -f
8 .I device
9 ] [
10 .B -t
11 .I indexfile
12 ] [options]
13 .I string ...
14 .PP
15 .SH DESCRIPTION
16 .B dds2tar
17 uses an index to find the files with record seek (a fast
18 operation of DAT devices).
19 Since the file structure of the tape archives is
20 used to extract the files, the archive has to be created by
21 .BR tar ,
22 compressed only by (the transparent
23 signal processor of) the device.
24 So you can step through the archive
25 very quickly and extract files.
26 The index may be created using
27 .BR dds2index
28 or
29 .BR tar -vRt
30 and is normally stored as a file on your hard disk.
31 .PP
32 A tar archive is a sequence of blocks (e.g. 10240 bytes by default),
33 each containing the same number (20 by default) of records, 512 byte each.
34 .B dds2tar
35 reads the tape and writes the tar records of the
36 specified files (that means the header record and the data records of each
37 selected file)
38 to stdout.
39 You may pipe the
40 .B dds2tar
41 output to the stdin of
42 .I tar -xvvf -
43 to restore the files to your disk.
44 (See
45 .B EXAMPLES
46 below.)
47 Before a file is extracted, 
48 the records of parent directories of the file are also written to stdout.
49 .PP
50 The index of the archive should contain enough information
51 to compute the number of the block containing the header of each selected
52 file.
53 .B dds2index
54 will give such a table,
55 .B tar -Rvt
56 e.g. will not (only record numbers are listed).
57 A patch for
58 .B GNU tar-1.12
59 is available, adding the option
60 .B --record-file.
61 Alternatively there are some tricks to get the missing
62 information.
63 .PP
64 The strings are regular expressions to select the files.
65 The matching algorithm is the one from GNU tar. If the option
66 .B -l
67 is given, the matched file names are printed to stdout (You may not pipe
68 this list of pathnames to tar!).
69 .PP
70 The default device is
71 .IR /dev/tape ,
72 which may be overridden with the environment variable
73 .BR TAPE ,
74 which in turn may be overridden with the
75 .BI -f\  device
76 option. The device must be a SCSI tape device.
77 .SH OPTIONS
78 .BI -f\  devicefile
79 Device of the tape archive. Must be a SCSI tape device.
80 .TP
81 .BI -t\  indexfile
82 Specifies the index file (default is stdin).
83 .TP
84 .BI -s\ #
85 Set the number of the first tape block of the archive. This option is
86 useful only if the index file contains the verbose output of
87 .B tar -Rvt.
88 Any information about the first block
89 inside the index file will be overridden by this option.
90 If no information is available, the archive has to be the first file of
91 the tape. If you have positioned your tape at the first block of the archive,
92 you can use
93 .IP
94 .B dds2tar `mt-dds` -t index ... | tar -f - ...
95 .IP
96 to complete the information of the output of
97 .B tar -Rvt
98 stored in the
99 index file.
100 .TP
101 .BI -b\ #
102 Set the blocksize of the archive (tar -b #). This option is
103 useful only if the index file contains the verbose output of tar (or if
104 you have problems with the size of the internal buffer of dds2tar).
105 Any information about the blocksize
106 inside the index file will be overridden by this option.
107 If no information is available, the default blocksize of tar is used.
108 .TP
109 .B -z
110 The index file should be read and stored in compressed mode.
111 .SH OPTIONS you didn't really need
112 .TP
113 .B --z, --no-compress
114 Don't filter the archive file through gzip.
115 .TP
116 .B -q, --quick
117 Don't extract the parent directories of the selected objects from tape.
118 .BR --body
119 Write only the first selected file to stdout. This is useful if you want to
120 read a file or extract an archive which is part of the current archive.
121 .TP
122 .BR -v , --verbose
123 verbose mode.
124 .TP
125 .B --hash-mode
126 Print a hash sign for each MB.
127 .TP
128 .BR -V , --version
129 Print only the Version Number to stderr.
130 .TP
131 .B -l
132 Don't access the tape but print the file names to stdout.
133 You may not pipe this list of pathnames into tar.
134 .TP
135 .B --extract
136 The stdout is closed and opened by a pipe to the command
137 .B "tar -fxb - 1".
138 You may find this option convenient, I like to pipe the output to tar
139 by hand.
140 .SH EXAMPLES
141 Example of
142 .B getting the index
143 from the default tape /dev/tape
144 and storing it in file archive.idx:
145 .IP
146 dds2index -t archive.idx
147 .PP
148 Alternatively you can use a patched version of tar to create an index file.
149 With the patch you can direct the errors and warning to stdout and the
150 index information including information about
151 the blocksize and the number of the 
152 first block to a file:
153 .IP
154 tar -t --record-file archive.idx
155 .PP
156 If the archive is the first file of the tape and the blocksize is the default
157 of 20, you can use the verbose output of tar (-Rv) as an index file.
158 .IP
159 tar -t -v -R | tee archive.idx
160 .PP
161 If the archive is not the first file of the tape, you can store all the
162 necessary information inside the index file with the use of
163 .B mt-dds
164 and
165 .B tar
166 :
167 .IP
168 .Sp
169 .nf
170 mt asf ...
171 mt-dds tell > archive.idx
172 tar -tvR >>archive.idx
173 .fi
174 .Sp
175 .PP
176 Example of
177 .B using dds2tar
178 to extract the gnu library
179 (all files containing the string "glibc" in filename)
180 from the default tape /dev/tape,
181 using the previously stored index file archive.idx:
182 .IP
183 dds2tar -t archive.idx '*glibc*' | tar xvvf -
184 .PP
185 .RP
186 To see in advance what would happen in the previous command
187 without actually writing anything to your disk,
188 you may use:
189 .IP
190 dds2tar -t archive.idx '*glibc*' | tar tvvf -
191 .PP
192 Example of checking the matches. You may try:
193 .IP
194 dds2tar -t archive.idx -l '*glibc*'
195 .PP
196 \"---------------------------------------------------------------------------
197 \"-----------------------
198 .SH BACKGROUND INFORMATION
199 .\"-----------------------
200 .SS tapes
201 .\"-----------
202 A tape device handles all I/O (read, write, seek) in units of 
203 .IR "tape records".
204 The bigger a tape record, the more effective usually is
205 the access (and the less gaps are on QIC-tapes).
206 However, normally a program will only read or write complete tape records.
207
208 Normal tape drives allow to seek only relative to the current
209 position. However, some newer SCSI-2 tapes, i.e. DAT, 
210 conforming to the DDS standard, 
211 keep track of the absolute position on the tape by inserting the
212 tape record number inside each track.
213 This number can be read while
214 the fast seek is performed.
215
216 The
217 .B tar(1) 
218 program uses a slightly different terminology.
219 It calls
220 .IR "tape blocks"  
221 what normally is called
222 .IR "tape records" .
223 In the following sections we use the tar terminology
224 to avoid confusion.
225 .SS tar
226 .\"-----------
227 The unit inside a 
228 .B tar 
229 archive is a 
230 .I tar record 
231 with a fixed length of 512 bytes. Every file, directory or soft link
232 will occupy at least one tar record of information about
233 pathname, permission information and so on called header record.
234 The data of each file is stored in additional tar records directly after
235 the header record of that file.
236 .PP
237 tar reports the 
238 .I tar record number 
239 of every header record in the archive with its -R option. 
240 tar counts the records continuously,
241 starting with 
242 .B 0 
243 (if invoked as tar -tR) or with 
244 .B 1 
245 (if invoked as tar -cR).
246 .PP
247 tar handles multiple records as a 
248 .IR "tar block" ,
249 mainly to make the access of tapes (or disks) more efficient (and save
250 tape space of QIC-tapes).
251 tar only writes and reads full blocks to or from an archive.
252 The -b option of tar controls, how many records are in
253 one block. The default number of records per block is 
254 .BR 20 .
255 This number is usually called the 
256 .IR "tar block size" .
257 However, this term is a little bit confusing, since
258 it does not mean the number of bytes in a block.
259 Thus a perhaps better name would be the 
260 .IR "tar blocking factor" .
261
262 .SS tar on tapes
263 .\"-----------
264 tar writes or reads its archive to or from tape in units of tar 
265 blocks.
266 As stated above, only a complete tape block may be transferred to/from 
267 tape.  To extract a specific tar block from tape, one has to
268 read an entire tape block into a buffer and extract
269 the specified tar record from the buffer manually.
270 If you would like to read a tar record with a given number,
271 you have to know the number of the first tape block of the archive
272 and the tar block size to compute the number of the tape block witch
273 contains the tar record to read.
274 If the tar archive is the first file on the tape, the
275 .I tape block number 
276 is the equal to the
277 .IR "tar block number" .
278 .PP
279 .B Example:
280 A file with the tar record number 1234 (records start with 0) 
281 may be found in a tape tar archive, written with a 
282 blocking factor of 20. 
283 It may be found in the tar block with the number
284 .RS 7
285          blk = (int) 1234/20 = (int) 61.7 = 61
286 .RE
287 which is also the tape block number.
288 The requested file is within this tar block at the record offset 
289 .RS 7
290          rec = 1234-(61*20) = 14
291 .RE
292 in 512 byte units.
293 .PP
294 If a current archive is not the first archive on the tape, then
295 the number of 
296 .I tape blocks 
297 of all previous archives has to be
298 added to the block number computed above,
299 to get the
300 .IR "current tape block number" .
301 The number of previous tape records 
302 should be obtained from DDS devices  
303 when the tape is positioned 
304 at the beginning of the current archive (use
305 .B mt-dds
306 without arguments for example).
307 .PP
308 .B Example:
309 Assuming the archive in the above example to be the second file 
310 on a tape, and the archive starts at tape block 20222. 
311 Then we will find our file with tar record number 1234
312 in the tape block
313 .RS 7
314          tblk = 20222 + (int) 1234/20 = 20283
315 .RE
316 on the tape.
317 The record offset inside the tape block will be the same as above.
318
319 \"---------------------------------------------------------------------------
320 .SH WARNING
321 This program can only read records (tar is calling them tape blocks)
322 up to 32 kbytes due to the limitations of the Linux device driver.
323 The extracted archive is written to stdout with a
324 block size of 512 bytes.
325
326 .SH ENVIRONMENT
327 The environment variable
328 .B TAPE
329 overrides the default tape device /dev/tape.
330 The variable
331 .B DDS2TAR cat be used to give some options, e.g.
332 .B --compress, -z, -s # , -b #.
333
334 .SH "SEE ALSO"
335 dds2index(1), mt(1), mt-dds(1), tar(1)
336
337 .SH HISTORY
338 This program was created to use the fast seek operation of my DAT
339 streamer. The tapes are called dds (digital data storage).
340 Since the program will write a tar archive to stdout,
341 I called this program
342 .BR dds2tar .
343 If I created the index file, I'm now
344 able to restore a file of 1MB within one minute even if the tape
345 contains more than 2GB of data.
346
347 Thanks to Andreas (Andreas_Bagge@h2.maus.de), who has written a nice
348 manual page for the overloaded version 1.1.3 of the program dds2tar
349 (I added too much features ... )
350 His manual page for dds2tar-1.1.3 gave me the idea how to split the
351 program dds2tar into the peaces dds2tar, dds2index and mt-dds.
352 Additionally his manual page was the starting point for this page.
353
354 Since the version 2.2 has a very robust algorithm to read the index file
355 and the ability of pattern matching, a lot of options where obsolete
356 and has been deleted. I tried to make dds2tar as simple I can.
357
358 .SH AUTHOR
359 J"org Weule (weule@cs.uni-duesseldorf.de), Phone +49 211 751409.
360 This software is available at
361 ftp.uni-duesseldorf.de:/pub/unix/apollo and
362 sunsite.unc.edu:/pub/Linux/system/Backup
363