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