]> Dogcows Code - chaz/tar/blob - doc/tar.texi
*** empty log message ***
[chaz/tar] / doc / tar.texi
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename tar.info
4 @settitle The Tar Manual: DRAFT
5 @setchapternewpage odd
6 @c %**end of header
7
8 @c Note: the edition number and date is listed in *two* places; please update.
9 @c subtitle and top node; search for !!set
10
11 @c Search for comments marked with !! or <<< (or >>>)
12
13 @smallbook
14
15 @iftex
16 @c finalout
17 @end iftex
18
19 @ifinfo
20 This file documents @code{tar}, a utility used to store, backup, and
21 transport files.
22
23 Copyright (C) 1992 Free Software Foundation, Inc. DRAFT!
24 @c Need to put distribution information here when ready.
25 @end ifinfo
26
27 @c !!set edition number and date here
28 @titlepage
29 @title @code{tar}
30 @subtitle The GNU Tape Archiver
31 @subtitle Edition 0.01, for @code{tar} Version 1.10
32 @subtitle @today{}
33 @c remove preceding today line when ready
34 @sp 1
35 @subtitle DRAFT
36 @c subtitle insert month here when ready
37
38 @author Michael I. Bushnell and Amy Gorin
39
40 @page
41 @vskip 0pt plus 1filll
42 Copyright @copyright{} 1992 Free Software Foundation, Inc.
43
44 @sp 2
45 This draft is not yet ready for distribution.
46 @end titlepage
47
48 @ifinfo
49 @node Top, Introduction, (dir), (dir)
50 @top @code{tar}
51
52 This file documents @code{tar}, a utility used to store, backup, and
53 transport files.
54
55 @c !!set edition number and date here
56 This is DRAFT Edition 0.01 of the @code{tar} documentation, @today{}, for @code{tar}
57 version 1.12.
58 @end ifinfo
59
60 @c <<< The menus need to be gone over, and node names fixed.
61 @menu
62 * Introduction:: @code{tar}: The GNU Tape Archiver
63 * Invoking @code{tar}:: How to invoke @code{tar}
64 * Tutorial:: Getting started
65 * Wizardry:: Some More Advanced Uses for @code{tar}
66 * Archive Structure:: The structure of an archive
67 * Reading and Writing:: Reading and writing archives
68 * Insuring Accuracy:: How to insure the accuracy of an archive
69 * Selecting Archive Members:: How to select archive members
70 * User Interaction:: How @code{tar} interacts with people.
71 * Backups and Restoration:: How to restore files and perform backups
72 * Media:: Using tapes and other archive media
73 * Quick Reference:: A quick reference guide to
74 @code{tar} operations and options
75 * Data Format Details:: Details of the archive data format
76 * Concept Index:: Concept Index
77 @end menu
78
79 @chapter Tutorial Introduction to @code{tar}
80
81 This chapter guides you through some basic examples of @code{tar}
82 operations. If you already know how to use some other version of
83 @code{tar}, then you probably don't need to read this chapter. This
84 chapter omits complicated details about many of the ways @code{tar}
85 works. See later chapters for full information.
86
87 @menu
88 * Creating Archives:: Creating Archives
89 * Extracting Files:: Extracting Files from an Archive
90 * Listing Archive Contents:: Listing the Contents of an Archive
91 * Comparing Files:: Comparing Archives with the File System
92 * Adding to Archives:: Adding Files to Existing Archives
93 * Concatenate:: Concatenating Archives
94 * Deleting Files:: Deleting Files From an Archive
95 @end menu
96
97 @section What @code{tar} Does
98
99 The @code{tar} program is used to create and manipulate @code{tar}
100 archives. An @dfn{archive} is a single file which contains within it
101 the contents of many files. In addition, the archive identifies the
102 names of the files, their owner, and so forth.
103
104 You can use @code{tar} archives in many ways. Initially, @code{tar}
105 archives were used to store files conveniently on magnetic tape. The
106 name @samp{tar} comes from this use; it stands for Tape ARchiver.
107 Often, @code{tar} archives are used to store related files for
108 convenient file transfer over a network. For example, the GNU Project
109 distributes its software bundled into @code{tar} archives, so that all
110 the files relating to a particular program (or set of related programs)
111 can be transferred as a single unit.
112
113 The files inside an archive are called @dfn{members}. Within this
114 manual, we use the term @dfn{file} to refer only to files accessible in
115 the normal ways (by @code{ls}, @code{cat}, and so forth), and the term
116 @dfn{members} to refer only to the members of an archive. Similarly, a
117 @dfn{file name} is the name of a file, as it resides in the filesystem,
118 and a @dfn{member name} is the name of an archive member within the
119 archive.
120
121 The @code{tar} program provides the ability to create @code{tar}
122 archives, as well as for various other kinds of manipulation. The term
123 @dfn{extraction} is used to refer to the process of copying an archive
124 member into a file in the filesystem. One might speak of extracting a
125 single member. Extracting all the members of an archive is often called
126 extracting the archive. Often the term @dfn{unpack} is used to refer to
127 the extraction of many or all the members of an archive.
128
129 Conventionally, @code{tar} archives are given names ending with
130 @samp{.tar}. This is not necessary for @code{tar} to operate properly,
131 but this manual follows the convention in order to get the reader used
132 to seeing it.
133
134 Occasionally archive members are referred to as files. For people
135 familiar with the operation of @code{tar}, this causes no difficulty.
136 However, this manual consistently uses the terminology above in
137 referring to files and archive members, to make it easier to learn how
138 to use @code{tar}.
139
140 @section How to Create Archives
141
142 To create a new archive, use @samp{tar --create}. You should generally
143 use the @samp{--file} option to specify the name the tar archive will
144 have. Then specify the names of the files you wish to place in the new
145 archive. For example, to place the files @file{apple}, @file{angst},
146 and @file{asparagus} into an archive named @file{afiles.tar}, use the
147 following command:
148
149 @example
150 tar --create --file=afiles.tar apple angst asparagus
151 @end example
152
153 The order of the arguments is not important. You could also say:
154
155 @example
156 tar apple --create angst --file=afiles.tar asparagus
157 @end example
158
159 This order is harder to understand however. In this manual, we will
160 list the arguments in a reasonable order to make the commands easier to
161 understand, but you can type them in any order you wish.
162
163 If you don't specify the names of any files to put in the archive, then
164 tar will create an empty archive. So, the following command will create
165 an archive with nothing in it:
166
167 @example
168 tar --create --file=empty-archive.tar
169 @end example
170
171 Whenever you use @samp{tar --create}, @code{tar} will erase the current
172 contents of the file named by @samp{--file} if it exists. To add files
173 to an existing archive, you need to use a different option.
174 @xref{Adding to Archives} for information on how to do this.
175
176 When @samp{tar --create} creates an archive, the member names of the
177 members of the archive are exactly the same as the file names as you
178 typed them in the @code{tar} command. So, the member names of
179 @file{afiles} (as created by the first example above) are @file{apple},
180 @file{angst}, and @file{asparagus}. However, suppose an archive were
181 created with this command:
182
183 @example
184 tar --create --file=bfiles.tar ./balloons baboon ./bodacious
185 @end example
186
187 Then, the three files @file{balloons}, @file{baboon}, and
188 @file{bodacious} would get placed in the archive (because @file{./} is a
189 synonym for the current directory), but their member names would be
190 @file{./balloons}, @file{baboon}, and @file{./bodacious}.
191
192 If you want to see the progress of tar as it writes files into the
193 archive, you can use the @samp{--verbose} option.
194
195 If one of the files named to @samp{tar --create} is a directory, then
196 the operation of tar is more complicated. @xref{Tar and Directories},
197 the last section of this tutorial, for more information.
198
199 If you don't specify the @samp{--file} option, then @code{tar} will use
200 a default. Usually this default is some physical tape drive attached to
201 your machine. If there is no tape drive attached, or the default is not
202 meaningful, then tar will print an error message. This error message
203 might look roughly like one of the following:
204
205 @example
206 tar: can't open /dev/rmt8 : No such device or address
207 tar: can't open /dev/rsmt0 : I/O error
208 @end example
209
210 If you get an error like this, mentioning a file you didn't specify
211 (@file{/dev/rmt8} or @file{/dev/rsmt0} in the examples above), then @code{tar}
212 is using a default value for @samp{--file}. You should generally specify a
213 @samp{--file} argument whenever you use @code{tar}, rather than relying
214 on a default.
215
216 @section How to List Archives
217
218 Use @samp{tar --list} to print the names of members stored in an
219 archive. Use a @samp{--file} option just as with @samp{tar --create} to
220 specify the name of the archive. For example, the archive
221 @file{afiles.tar} created in the last section could be examined with the
222 command @samp{tar --list --file=afiles.tar}. The output of tar would
223 then be:
224
225 @example
226 apple
227 angst
228 asparagus
229 @end example
230
231 The archive @file{bfiles.tar} would list as follows:
232
233 @example
234 ./baloons
235 baboon
236 ./bodacious
237 @end example
238
239 (Of course, @samp{tar --list --file=empty-archive.tar} would produce no
240 output.)
241
242 If you use the @samp{--verbose} option with @samp{tar --list}, then tar
243 will print out a listing reminiscent of @samp{ls -l}, showing owner,
244 file size, and so forth.
245
246 You can also specify member names when using @samp{tar --list}. In this
247 case, tar will only list the names of members you identify. For
248 example, @samp{tar --list --file=afiles.tar apple} would only print
249 @samp{apple}. It is essential when specifying member names to tar that
250 you give the exact member names. For example, @samp{tar --list
251 --file=bfiles baloons} would produce no output, because there is no
252 member named @file{baloons}, only one named @file{./baloons}. While the
253 file names @file{baloons} and @file{./baloons} name the same file,
254 member names are compared using a simplistic name comparison, in which
255 an exact match is necessary.
256
257 @section How to Extract Members from an Archive
258
259 In order to extract members from an archive, use @samp{tar --extract}.
260 Specify the name of the archive with @samp{--file}. To extract specific
261 archive members, give their member names as arguments. It essential to
262 give their exact member name, as printed by @samp{tar --list}. This
263 will create a copy of the archive member, with a file name the same as
264 its name in the archive.
265
266 Keeping the example of the two archives created at the beginning of this
267 tutorial, @samp{tar --extract --file=afiles.tar apple} would create a
268 file @file{apple} in the current directory with the contents of the
269 archive member @file{apple}. It would remove any file named
270 @file{apple} already present in the directory, but it would not change
271 the archive in any way.
272
273 Remember that specifying the exact member name is important. @samp{tar
274 --extract --file=bfiles.tar baloons} will fail, because there is no
275 member named @file{baloons}. To extract the member named
276 @file{./baloons} you would need to specify @samp{tar --extract
277 --file=bfiles.tar ./baloons}. To find the exact member names of the
278 members of an archive, use @samp{tar --list} (@pxref{Listing
279 Archives}).
280
281 If you do not list any archive member names, then @samp{tar --extract}
282 will extract all the members of the archive.
283
284 If you give the @samp{--verbose} option, then @samp{tar --extract} will
285 print the names of the archive members as it extracts them.
286
287 @section How to Add Files to Existing Archives
288
289 If you want to add files to an existing archive, then don't use
290 @samp{tar --create}. That will erase the archive and create a new one
291 in its place. Instead, use @samp{tar --append}. The command @samp{tar
292 --append --file=afiles.tar arbalest} would add the file @file{arbalest}
293 to the existing archive @file{afiles.tar}. The archive must already
294 exist in order to use @samp{tar --append}.
295
296 As with @samp{tar --create}, the member names of the newly added files
297 will be the exact same as their names given on the command line. The
298 @samp{--verbose} option will print out the names of the files as they
299 are written into the archive.
300
301 If you add a file to an archive using @samp{tar --append} with the
302 same name as an archive member already present in the archive, then the
303 old member is not deleted. What does happen, however, is somewhat
304 complex. @xref{Multiple Members with the Same Name}. If you want to
305 replace an archive member, use @samp{tar --delete} first, and then use
306 @samp{tar --append}.
307
308 @section How to Delete Members from Archives
309
310 You can delete members from an archive using @samp{tar --delete}.
311 Specify the name of the archive with @samp{--file}. List the member
312 names of the members to be deleted. (If you list no member names, then
313 nothing will be deleted.) The @samp{--verbose} option will cause
314 @code{tar} to print the names of the members as they are deleted. As
315 with @samp{tar --extract}, it is important that you give the exact
316 member names when using @samp{tar --delete}. Use @samp{tar --list} to
317 find out the exact member names in an archive (@pxref{Listing
318 Archives}).
319
320 The @samp{tar --delete} command only works with archives stored on disk.
321 You cannot delete members from an archive stored on a tape.
322
323 @section How to Archive Directories
324
325 When the names of files or members specify directories, the operation of
326 @code{tar} is more complex. Generally, when a directory is named,
327 @code{tar} also operates on all the contents of the directory,
328 recursively. Thus, to @code{tar}, the file name @file{/} names the
329 entire file system.
330
331 To archive the entire contents of a directory, use @samp{tar --create}
332 (or @samp{tar --append}) as usual, and specify the name of the
333 directory. For example, to archive all the contents of the current
334 directory, use @samp{tar --create --file=@var{archive-name} .}. Doing
335 this will give the archive members names starting with @samp{./}. To
336 archive the contents of a directory named @file{foodir}, use @samp{tar
337 --create --file=@var{archive-name} foodir}. In this case, the member
338 names will all start with @samp{foodir/}.
339
340 If you give @code{tar} a command such as @samp{tar --create
341 --file=foo.tar .}, it will report @samp{tar: foo.tar is the archive; not
342 dumped}. This happens because the archive @file{foo.tar} is created
343 before putting any files into it. Then, when @code{tar} attempts to add
344 all the files in the directory @file{.} to the archive, it notices that
345 the file @file{foo.tar} is the same as the archive, and skips it. (It
346 makes no sense to put an archive into itself.) GNU @code{tar} will
347 continue in this case, and create the archive as normal, except for the
348 exclusion of that one file. Other versions of @code{tar}, however, are
349 not so clever, and will enter an infinite loop when this happens, so you
350 should not depend on this behavior. In general, make sure that the
351 archive is not inside a directory being dumped.
352
353 When extracting files, you can also name directory archive members on
354 the command line. In this case, @code{tar} extracts all the archive
355 members whose names begin with the name of the directory. As usual,
356 @code{tar} is not particularly clever about interpreting member names.
357 The command @samp{tar --extract --file=@var{archive-name} .} will not
358 extract all the contents of the archive, but only those members whose
359 member names begin with @samp{./}.
360
361 @section Shorthand Names
362
363 Most of the options to @code{tar} come in both long forms and short
364 forms. The options described in this tutorial have the following
365 abbreviations (except @samp{--delete}, which has no shorthand form):
366
367 @table @samp
368 @item --create
369 @samp{-c}
370 @item --list
371 @samp{-t}
372 @item --extract
373 @samp{-x}
374 @item --append
375 @samp{-r}
376 @item --verbose
377 @samp{-v}
378 @item --file=@var{archive-name}
379 @samp{-f @var{archive-name}}
380 @end table
381
382 These options make typing long @code{tar} commands easier. For example,
383 instead of typing
384 @example
385 tar --create --file=/tmp/afiles.tar --verbose apple angst asparagus
386 @end example
387 you can type
388 @example
389 tar -c -f /tmp/afiles.tar -v apple angst asparagus
390 @end example
391
392 For more information on option syntax, @ref{Invoking @code{tar}}. In
393 the remainder of this manual, short forms and long forms are given
394 together when an option is discussed.
395
396 @chapter Invoking @code{tar}
397
398 The usual way to invoke tar is
399
400 @example
401 @code{tar} @var{options}... [@var{file-or-member-names}...]
402 @end example
403
404 All the options start with @samp{-}. You can actually type in arguments
405 in any order, but in this manual the options always precede the other
406 arguments, to make examples easier to understand.
407
408 @menu
409 * Option Form:: The Forms of Arguments
410 * Argument Functions:: The Functions of Arguments
411 * Old Syntax for Commands:: An Old, but Still Supported, Syntax
412 for @code{tar} Commands
413 @end menu
414
415 @section The Forms of Arguments
416
417 Most options of @code{tar} have a single letter form (a single letter
418 preceded by @samp{-}), and at least one mnemonic form (a word or
419 abbreviation preceded by @samp{--}). The forms are absolutely
420 identical in function. For example, you can use either @samp{tar -t}
421 or @samp{tar --list} to list the contents of an archive. In addition,
422 mnemonic names can be given unique abbreviations. For example,
423 @samp{--cre} can be used in place of @samp{--create} because there is
424 no other option which begins with @samp{cre}.
425
426 Some options require an additional argument. Single letter options
427 which require arguments use the immediately following argument.
428 Mnemonic options are separated from their arguments by an @samp{=}
429 sign. For example, to create an an archive file named
430 @file{george.tar}, use either @samp{tar --create --file=george.tar} or
431 @samp{tar --create -f george.tar}. Both
432 @samp{--file=@var{archive-name}} and @samp{-f @var{archive-name}} denote
433 the option to give the archive a non-default name, which in the example
434 is @file{george.tar}.
435
436 You can mix single letter and mnemonic forms in the same command. You
437 could type the above example as @samp{tar -c --file=george} or
438 @samp{tar --create -f george}. However, @code{tar} operations and
439 options are case sensitive. You would not type the above example as
440 @samp{tar -C --file=george}, because @samp{-C} is an option that
441 causes @code{tar} to change directories, not an operation that creates
442 an archive. In fact, @samp{-C} requires a further argument (the name
443 of the directory which to change to). In this case, tar would think
444 it needs to change to a directory named @samp{--file=george}, and
445 wouldn't interpret @samp{--file-george} as an option at all!
446
447 @section The Functions of Arguments
448
449 You must give exactly one option from the following list to tar. This
450 option specifies the basic operation for @code{tar} to perform.
451
452 @table samp
453 @item --help
454 Print a summary of the options to @code{tar} and do nothing else
455
456 @item --create
457 @item -c
458 Create a new archive
459
460 @item --catenate
461 @item --concatenate
462 @item -A
463 Add the contents of one or more archives to another archive
464
465 @item --append
466 @item -a
467 Add files to an existing archive
468
469 @item --list
470 @item -t
471 List the members in an archive
472
473 @item --delete
474 Delete members from an archive
475
476 @item --extract
477 @item --get
478 @item -x
479 Extract members from an archive
480
481 @item --compare
482 @item --diff
483 @item -d
484 Compare members in an archive with files in the file system
485
486 @item --update
487 @item -u
488 Update an archive by appending newer versions of already stored files
489 @end itemize
490
491 The remaining options to @code{tar} change details of the operation,
492 such as archive format, archive name, or level of user interaction.
493 You can specify more than one option.
494
495 The remaining arguments are interpreted either as file names or as
496 member names, depending on the basic operation @code{tar} is
497 performing. For @samp{--append} and @samp{--create} these arguments
498 specify the names of files (which must already exist) to place in the
499 archive. For the remaining operation types, the additional arguments
500 specify archive members to compare, delete, extract, list, or update.
501 When naming archive members, you must give the exact name of the member
502 in the archive, as it is printed by @code{tar --list}. When naming
503 files, the normal file name rules apply.
504
505 If you don't use any additional arguments, @samp{--append},
506 @samp{--catenate}, and @samp{--delete} will do nothing. Naturally,
507 @samp{--create} will make an empty archive if given no files to add.
508 The other operations of @code{tar} (@samp{--list}, @samp{--extract},
509 @samp{--compare}, and @samp{--update}) will act on the entire contents
510 of the archive.
511
512 If you give the name of a directory as either a file name or a member
513 name, then @code{tar} acts recursively on all the files and directories
514 beneath that directory. For example, the name @file{/} identifies all
515 the files in the filesystem to @code{tar}.
516
517 @section An Old, but Still Supported, Syntax for @code{tar} Commands
518
519 For historical reasons, GNU @code{tar} also accepts a syntax for
520 commands which splits options that require additional arguments into
521 two parts. That syntax is of the form:
522
523 @example
524 @code{tar} @var{option-letters}... [@var{option-arguments}...] [@var{file-names}...]@refill
525 @end example
526
527 @noindent
528 where arguments to the options appear in the same order as the letters
529 to which they correspond, and the operation and all the option letters
530 appear as a single argument, without separating spaces.
531
532 This command syntax is useful because it lets you type the single
533 letter forms of the operation and options as a single argument to
534 @code{tar}, without writing preceding @samp{-}s or inserting spaces
535 between letters. @samp{tar cv} or @samp{tar -cv} are equivalent to
536 @samp{tar -c -v}.
537
538 On the other hand, this old style syntax makes it difficult to match
539 option letters with their corresponding arguments, and is often
540 confusing. In the command @samp{tar cvbf 20 /dev/rmt0}, for example,
541 @samp{20} is the argument for @samp{-b}, @samp{/dev/rmt0} is the
542 argument for @samp{-f}, and @samp{-v} does not have a corresponding
543 argument. The modern syntax---@samp{tar -c -v -b 20 -f
544 /dev/rmt0}---is clearer.
545
546 @chapter Basic @code{tar} Operations
547
548 This chapter describes the basic operations supported by the @code{tar}
549 program. A given invocation of @code{tar} will do exactly one of these
550 operations.
551
552 @section Creating a New Archive
553
554 The @samp{--create} (@code{-c}) option causes @code{tar} to create a new
555 archive. The files to be archived are then named on the command line.
556 Each file will be added to the archive with a member name exactly the
557 same as the name given on the command line. (When you give an absolute
558 file name @code{tar} actually modifies it slightly, @ref{Absolute
559 Paths}.) If you list no files to be archived, then an empty archive is
560 created.
561
562 If there are two many files to conveniently list on the command line,
563 you can list the names in a file, and @code{tar} will read that file.
564 @xref{Reading Names from a File}.
565
566 If you name a directory, then @code{tar} will archive not only the
567 directory, but all its contents, recursively. For example, if you name
568 @file{/}, then @code{tar} will archive the entire filesystem.
569
570 Do not use the option to add files to an existing archive; it will
571 delete the archive and write a new one. Use @samp{--append} instead.
572 (@xref{Adding to an Existing Archive}.)
573
574 There are various ways of causing @code{tar} to skip over some files,
575 and not archive them. @xref{Specifying Names to @code{tar}}.
576
577 @section Adding to an Existing Archive
578
579 The @samp{--append} (@code{-r}) option will case @code{tar} to add new
580 files to an existing archive. It interprets file names and member names
581 in exactly the same manner as @samp{--create}. Nothing happens if you
582 don't list any names.
583
584 This option never deletes members. If a new member is added under the
585 same name as an existing member, then both will be in the archive, with
586 the new member after the old one. For information on how this affects
587 reading the archive, @ref{Multiple Members with the Same Name}.
588
589 This operation cannot be performed on some tape drives, unfortunately,
590 due to deficiencies in the formats thoes tape drives use.
591
592 @section Combining Archives
593
594 The @samp{--catenate} (or @code{--concatenate}, or @code{-A}) causes
595 @code{tar} to add the contents of several archives to an existing
596 archive.
597
598 Name the archives to be catenated on the command line. (Nothing happens
599 if you don't list any.) The members, and their member names, will be
600 copied verbatim from those archives. If this causes multiple members to
601 have the same name, it does not delete either; all the members with the
602 same name coexist. For information on how this affects reading the
603 archive, @ref{Multiple Members with the Same Name}.
604
605 You must use this option to concatenate archives. If you just combine
606 them with @code{cat}, the result will not be a valid @code{tar} format
607 archive.
608
609 This operation cannot be performed on some tape drives, unfortunately,
610 due to deficiencies in the formats thoes tape drives use.
611
612 @section Removing Archive Members
613
614 You can use the @samp{--delete} option to remove members from an
615 archive. Name the members on the command line to be deleted. This
616 option will rewrite the archive; because of this, it does not work on
617 tape drives. If you list no members to be deleted, nothing happens.
618
619 @section Listing Archive Members
620
621 The @samp{--list} (@samp{-t}) option will list the names of members of
622 the archive. Name the members to be listed on the command line (to
623 modify the way these names are interpreted, @pxref{Specifying Names to
624 @code{tar}}). If you name no members, then @samp{--list} will list the
625 names of all the members of the archive.
626
627 To see more than just the names of the members, use the @samp{--verbose}
628 option to cause @code{tar} to print out a listing similar to that of
629 @samp{ls -l}.
630
631 @section Extracting Archive Members
632
633 Use @samp{--extract} (or @samp{--get}, or @samp{-x}) to extract members
634 from an archive. For each member named (or for the entire archive if no
635 members are named) on the command line (or with @samp{--files-from}) the
636 a file is created with the contents of the archive member. The name of
637 the file is the same as the member name.
638
639 Various options cause @code{tar} to extract more than just file
640 contents, such as the owner, the permissions, the modification date, and
641 so forth.
642
643 XXX
644 The @samp{--same-permissions} (or @samp{--preserve-permissions}, or
645 @samp{-p}) options cause @code{tar} to cause the new file to have the
646 same permissions as the original file did when it was placed in the
647 archive. Without this option, the current @code{umask} is used to
648 affect the permissions.
649
650 When extrating, @code{tar} normally sets the modification time of the
651 file to the value recorded in the archive. The
652 @samp{--modification-time} option causes @code{tar} to omit doing this.
653 XXX
654
655 @section Updating an Archive
656
657 The @samp{--update} (or @samp{-u}) option updates a @code{tar} archive
658 by comparing the date of the specified archive members against the date
659 of the file with the same name. If the file has been modified more
660 recently than the archive member, then the archive member is deleted (as
661 with @samp{--delete}) and then the file is added to the archive (as with
662 @samp{--append}). On media where the @samp{--delete} option cannot be
663 performed (such as magnetic tapes), the @samp{--update} option similarly
664 fails.
665
666 If no archive members are named (either on the command line or via
667 @samp{--files-from}), then the entire archive is processed in this
668 manner.
669
670 @section Comparing Archives Members with Files
671
672 The @samp{--compare} (or @samp{--diff}, or @samp{-d}) option compares
673 the contents of the specified archive members against the files with the
674 same names, and reports its findings. If no members are named on the
675 command line (or through @samp{--files-from}), then the entire archive
676 is so compared.
677
678 @chapter Specifying Names to @code{tar}
679
680 When specifying the names of files or members to @code{tar}, it by
681 default takes the names of the files from the command line. There are
682 other ways, however, to specify file or member names, or to modify the
683 manner in which @code{tar} selects the files or members upon which to
684 operate. In general, these methods work both for specifying the names
685 of files and archive members.
686
687 @section Reading Names from a File
688
689 Instead of giving the names of files or archive members on the command
690 line, you can put the names into a file, and then use the
691 @samp{--files-from=@var{file-name-list}} (@samp{-T
692 @var{file-name-list}}) option to @code{tar}. Give the name of the file
693 which contains the list as the argument to @samp{--files-from}. The
694 file names should be separated by newlines in the list. If you give a
695 single dash as a filename for @samp{--files-from} (that is, you specify
696 @samp{--files-from=-} or @samp{-T -}), then the filenames are read from
697 standard input.
698
699 If you want to specify names that might contain newlines, use the
700 @samp{--null} option. Then, the filenames should be separated by NUL
701 characters (ASCII 000) instead of newlines. In addition, the
702 @samp{--null} option turns off the @samp{-C} option (@pxref{Changing
703 Directory}).
704
705 @section Excluding Some Files
706
707 The @samp{--exclude=@var{pattern}} option will prevent any file or
708 member which matches the regular expression @var{pattern} from being
709 operated on. For example, if you want to create an archive with all the
710 contents of @file{/tmp} except the file @file{/tmp/foo}, you can use the
711 command @samp{tar --create --file=arch.tar --exclude=foo}.
712
713 If there are many files you want to exclude, you can use the
714 @samp{--exclude-from=@var{exclude-list}} (@samp{-X @var{exclude-list}})
715 option. This works just like the
716 @samp{--files-from=@var{file-name-list}} option: specify the name of a
717 file as @var{exclude-list} which contains the list of patterns you want
718 to exclude.
719
720 @xref{Regular Expressions} for more information on the syntax and
721 meaning of regular expressions.
722
723 @section Operating Only on New Files
724
725 The @samp{--newer=@var{date}} (@samp{--after-date=@var{date}} or
726 @samp{-N @var{date}}) limits @code{tar} to only operating on files which
727 have been modified after the date specified. (For more information on
728 how to specify a date, @xref{Date Formats}.) A file is considered to
729 have changed if the contents have been modified, or if the owner,
730 permissions, and so forth, have been changed.
731
732 If you only want @code{tar} make the date comparison on the basis of the
733 actual contents of the file's modification, then use the
734 @samp{--newer-mtime=@var{date}} option.
735
736 You should never use this option for making incremental dumps. To learn
737 how to use @code{tar} to make backups, @ref{Making Backups}.
738
739 @section Crossing Filesystem Boundaries
740
741 The @samp{--one-file-system} option causes @code{tar} to modify its
742 normal behavior in archiving the contents of directories. If a file in
743 a directory is not on the same filesystem as the directory itself
744 (because it is a mounted filesystem in its own right), then @code{tar}
745 will not archive that file, or (if it is a directory itself) anything
746 beneath it.
747
748 This does not necessarily limit @code{tar} to only archiving the
749 contents of a single filesystem, because all files named on the command
750 line (or through the @samp{--files-from} option) will always be
751 archived.
752
753 @chapter Changing the Names of Members when Archiving
754
755 @section Changing Directory
756
757 The @samp{--directory=@var{directory}} (@samp{-C @var{directory}})
758 option causes @code{tar} to change its current working directory to
759 @var{directory}. Unlike most options, this one is processed at the
760 point it occurs within the list of files to be processed. Consider the
761 following command:
762 @example
763 tar --create --file=foo.tar -C /etc passwd hosts -C /lib libc.a
764 @end example
765
766 This command will place the files @file{/etc/passwd}, @file{/etc/hosts},
767 and @file{/lib/libc.a} into the archive. However, the names of the
768 archive members will be exactly what they were on the command line:
769 @file{passwd}, @file{hosts}, and @file{libc.a}. The @samp{--directory}
770 option is frequently used to make the archive independent of the
771 original name of the directory holding the files.
772
773 Note that @samp{--directory} options are interpreted consecutively. If
774 @samp{--directory} option specifies a relative pathname, it is
775 interpreted relative to the then current directory, which might not be
776 the same as the original current working directory of @code{tar}, due to
777 a previous @samp{--directory} option.
778
779 When using @samp{--files-from} (@pxref{Reading Names from a File}), you
780 can put @samp{-C} options in the file list. Unfortunately, you cannot
781 put @samp{--directory} options in the file list. (This interpretation
782 can be disabled by using the @samp{--null} option.)
783
784 @section Absolute Path Names
785
786 When @code{tar} extracts archive members from an archive, it strips any
787 leading slashes (@code{/}) from the member name. This causes absolute
788 member names in the archive to be treated as relative file names. This
789 allows you to have such members extracted wherever you want, instead of
790 being restricted to extracting the member in the exact directory named
791 in the archive. For example, if the archive member has the name
792 @file{/etc/passwd}, @code{tar} will extract it as if the name were
793 really @file{etc/passwd}.
794
795 Other @code{tar} programs do not do this. As a result, if you create an
796 archive whose member names start with a slash, they will be difficult
797 for other people with an inferior @code{tar} program to use. Therefore,
798 GNU @code{tar} also strips leading slashes from member names when
799 putting members into the archive. For example, if you ask @code{tar} to
800 add the file @file{/bin/ls} to an archive, it will do so, but the member
801 name will be @file{bin/ls}.
802
803 If you use the @samp{--absolute-paths} option, @code{tar} will do
804 neither of these transformations.
805
806 @section Symbolic Links
807
808 Normally, when @code{tar} archives a symbolic link, it writes a record
809 to the archive naming the target of the link. In that way, the
810 @code{tar} archive is a faithful record of the filesystem contents.
811 However, if you want @code{tar} to actually dump the contents of the
812 target of the symbolic link, then use the @samp{--dereference} option.
813
814 @chapter Making @code{tar} More Verbose
815
816 Various options cause @code{tar} to print information as it progresses
817 in its job.
818
819 The @samp{--verbose} (or @samp{-v}) option causes @code{tar} to print
820 the name of each archive member or file as it is processed. Since
821 @samp{--list} already prints the names of the members, @samp{--verbose}
822 used with @samp{--list} causes @code{tar} to print a longer listing
823 (reminiscent of @samp{ls -l}) for each member.
824
825 To see the progress of @code{tar} through the archive, the
826 @samp{--record-number} option prints a message for each record read or
827 writted. (@xref{Archive Structure}.)
828
829 The @samp{--totals} option (which is only meaningful when used with
830 @samp{--create}) causes @code{tar} to print the total amount written to
831 the archive, after it has been fully created.
832
833 The @samp{--checkpoint} option prints an occasional message as
834 @code{tar} reads or writes the archive. It is designed for those who
835 don't need the more detailed (and voluminous) output of
836 @samp{--record-number}, but do want visual confirmation that @code{tar}
837 is actually making forward progress.
838
839 @chapter Input and Output
840
841 @section Changing the Archive Name
842
843 By default, @code{tar} uses an archive file name compiled in when
844 @code{tar} was built. Usually this refers to some physical tape drive
845 on the machine. Often, the installer of @code{tar} didn't set the
846 default to anything meaningful at all.
847
848 As a result, most uses of @code{tar} need to tell @code{tar} where to
849 find (or create) the archive. The @samp{--file=@var{archive-name}} (or
850 @samp{-f @var{archive-name}} option selects another file to use as the
851 archive.
852
853 If the archive file name includes a colon (@samp{:}), then it is assumed
854 to be a file on another machine. If the archive file is
855 @samp{@var{user}@@@var{host}:@var{file}}, then @var{file} is used on the
856 host @var{host}. The remote host is accessed using the @code{rsh}
857 program, with a username of @var{user}. If the username is omitted
858 (along with the @samp{@@} sign), then your user name will be used.
859 (This is the normal @code{rsh} behavior.) It is necessary for the
860 remote machine, in addition to permitting your @code{rsh} access, to
861 have the @code{/usr/ucb/rmt} program installed. If you need to use a
862 file whose name includes a colon, then the remote tape drive behavior
863 can be inhibited by using the @samp{--force-local} option.
864
865 If the filename you give to @samp{--file} is a single dash (@samp{-}),
866 then @code{tar} will read the archive from (or write it to) standard
867 input (or standard output).
868
869 @section Extracting Members to Standard Output
870
871 An archive member in normally extracted into a file with the same name
872 as the archive member. However, you can use the @samp{--to-stdout} to
873 cause @code{tar} to write extracted archive members to standard output.
874 If you extract multiple members, they appear on standard output
875 concatenated, in the order they are found in the archive.
876
877 @chapter Being More Careful
878
879 When using @code{tar} with many options, particularly ones with
880 complicated or difficult-to-predict behavior, it is possible to make
881 serious mistakes. As a result, @code{tar} provides several options that
882 make observing @code{tar} easier.
883
884 The @samp{--verbose} option (@pxref{Making @code{tar} More Verbose})
885 causes @code{tar} to print the name of each file or archive member as it
886 is processed.
887
888 If you use @samp{--interactive} (or {@samp--confirm}), then @code{tar}
889 will ask you for confirmation before each operation. For example, when
890 extracting, it will prompt you before each archive member is extracted,
891 and you can select that member for extraction or pass over to the next.
892
893 The @samp{--verify} option, when using @samp{--create}, causes
894 @code{tar}, after having finished creating the archive, to go back over
895 it and compare its contents against the files that were placed in the
896 archive.
897
898 The @samp{--show-omitted-dirs} option, when reading an archive (with
899 @samp{--list} or @samp{--extract}, for example), causes a message to be
900 printed for each directory in the archive which is skipped. This
901 happens regardless of the reason for skipping: the directory might not
902 have been named on the command line (implicitly or explicitly), it might
903 be excluded by the use of the @samp{--exclude} option, or some other
904 reason.
905
906 @chapter Using Real Tape Drives
907
908 Many complexities surround the use of @code{tar} on tape drives. Since
909 the creation and manipulation of archives located on magnetic tape was
910 the original purpose of @code{tar}, it contains many features making
911 such manipulation easier.
912
913 @section Blocking
914
915 When writing to tapes, @code{tar} writes the contents of the archive in
916 chunks known as @dfn{blocks}. To change the default blocksize, use the
917 @samp{--block-size=@var{blocking-factor}} (@samp{-b
918 @var{blocking-factor}) option. Each block will then be composed of
919 @var{blocking-factor} records. (Each @code{tar} record is 512 bytes.
920 @xref{Archive Format}.) Each file written to the archive uses at least
921 one full block. As a result, using a larger block size can result in
922 more wasted space for small files. On the other hand, a larger block
923 size can ofter be read and written much more efficiently.
924
925 Further complicating the problem is that some tape drives ignore the
926 blocking entirely. For these, a larger block size can still improve
927 performance (because the software layers above the tape drive still
928 honor the blocking), but not as dramatically as on tape drives that
929 honor blocking.
930
931 Wher reading an archive, @code{tar} can usually figure out the block
932 size on itself. When this is the case, and a non-standard block size
933 was used when the archive was created, @code{tar} will print a message
934 about a non-standard blocking factor, and then operate normally. On
935 some tape devices, however, @code{tar} cannot figure out the block size
936 itself. On most of those, you can specify a blocking factor (with
937 @samp{--block-size) larger than the actual blocking factor, and then use
938 the @samp{--read-full-blocks} option. (If you specify a blocking factor
939 with @samp{--block-size} and don't use the @samp{--read-full-blocks}
940 option, then @code{tar} will not attempt to figure out the blocking size
941 itself.) On some devices, you must always specify the block size
942 exactly with @samp{--block-size} when reading, because @code{tar} cannot
943 figure it out. In any case, use @samp{--list} before doing any
944 extractions to see whether @code{tar} is reading the archive correctly.
945
946 If you use a blocking factor larger than 20, older @code{tar} programs
947 might not be able to read the archive, so we recommend this as a limit
948 to use in practice. GNU @code{tar}, however, will support arbitrarily
949 large block sizes, limited only by the amount of virtual memory or the
950 physical characteristics of the tape device.
951
952 @section Using Multiple Tapes
953
954 Often you might want to write a large archive, one larger than will fit
955 on the actual tape you are using. In such a case, you can run multiple
956 @code{tar} commands, but this can be inconvenient, particularly if you
957 are using options like @samp{--exclude} or dumping entire filesystems.
958 Therefore, @code{tar} supports multiple tapes automatically.
959
960 Use @samp{--multi-volume} on the command line, and then @code{tar} will,
961 when it reaches the end of the tape, prompt for another tape, and
962 continue the archive. Each tape will have an independent archive, and
963 can be read without needing the other. (As an exception to this, the
964 file that @code{tar} was archiving when it ran out of tape will usually
965 be split between the two archives; in this case you need to extract from
966 the first archive, using @samp{--multi-volume}, and then put in the
967 second tape when prompted, so @code{tar} can restore both halves of the
968 file.)
969
970 When prompting for a new tape, @code{tar} accepts any of the following
971 responses:
972
973 @table @samp
974 @item ?
975 Request @code{tar} to explain possible responses
976 @item q
977 Request @code{tar} to exit immediately.
978 @item n @var{file-name}
979 Request @code{tar} to write the next volume on the file @var{file-name}.
980 @item !
981 Request @code{tar} to run a subshell.
982 @item y
983 Request @code{tar} to begin writing the next volume.
984 @end table
985
986 (You should only type @samp{y} after you have changed the tape;
987 otherwise @code{tar} will write over the volume it just finished.)
988
989 If you want more elaborate behavior than this, give @code{tar} the
990 @samp{--info-script=@var{script-name}} option. The file
991 @var{script-name} is expected to be a program (or shell script) to be
992 run instead of the normal prompting procedure. When the program
993 finishes, @code{tar} will immediately begin writing the next volume.
994 (The behavior of the @samp{n} response to the normal tape-change prompt
995 is not available if you use @samp{--info-script}.)
996
997 The method @code{tar} uses to detect end of tape is not perfect, and
998 fails on some operating systems or on some devices. You can use the
999 @samp{--tape-length=@var{size}} (or @samp{-L @var{size}}) option if
1000 @code{tar} can't detect the end of the tape itself. The @var{size}
1001 argument should be the size of the tape.
1002
1003 The volume number used by @code{tar} in its tape-change prompt can be
1004 changed; if you give the @samp{--volno-file=@var{file-name}} option,
1005 then @var{file-name} should contain a decimal number. That number will
1006 be used as the volume number of the first volume written. When
1007 @code{tar} is finished, it will rewrite the file with the now--current
1008 volume number. (This does not change the volume number written on a
1009 tape label; it @emph{only} affects the number used in the prompt.)
1010
1011 If you want @code{tar} to cycle through a series of tape drives, then
1012 you can use the @samp{n} response to the tape-change prompt. This is
1013 error prone, however, and doesn't work at all with @samp{--info-script}.
1014 Therefore, if you give @code{tar} multiple @samp{--file} options, then
1015 the specified files will be used, in sequence, as the successive volumes
1016 of the archive. Only when the first one in the sequence needs to be
1017 used again will @code{tar} prompt for a tape change (or run the info
1018 script).
1019
1020
1021
1022
1023
1024
1025
1026 XXXX MIB XXXX
1027
1028
1029
1030 @node Wizardry, Archive Structure, Tutorial, Top
1031 @chapter Wizardry
1032
1033 <<<This section needs to be written -ringo
1034
1035 @strong{To come:} using Unix file linking capability to recreate directory
1036 structures---linking files into one subdirectory and then tarring that
1037 directory.
1038
1039 @strong{to come:} nice hairy example using absolute-paths, newer, etc.
1040
1041
1042 Piping one @code{tar} to another is an easy way to copy a directory's
1043 contents from one disk to another, while preserving the dates, modes, owners
1044 and link-structure of all the files therein.
1045
1046 @example
1047 cd sourcedirectory; tar cf - . | (cd targetdir; tar xf -)
1048 @end example
1049
1050 @noindent
1051 or
1052
1053 <<< the following using standard input/output correct??
1054 @example
1055 cd sourcedirectory; tar --create --file=- . | (cd targetdir; tar --extract --file=-)
1056 @end example
1057
1058 @noindent
1059
1060 Archive files can be used for transporting a group of files from one system
1061 to another: put all relevant files into an archive on one computer system,
1062 transfer the archive to another, and extract the contents there. The basic
1063 transfer medium might be magnetic tape, Internet FTP, or even electronic
1064 mail (though you must encode the archive with @code{uuencode} in order to
1065 transport it properly by mail). Both machines do not have to use the same
1066 operating system, as long as they both support the @code{tar} program.
1067 @findex uuencode
1068 <<< mention uuencode on a paragraph of its own
1069
1070 <<<<<end construction>>>>>
1071
1072 @node Archive Structure, Reading and Writing, Wizardry, Top
1073 @chapter The Structure of an Archive
1074
1075 While an archive may contain many files, the archive itself is a
1076 single ordinary file. Like any other file, an archive file can be
1077 written to a storage device such as a tape or disk, sent through a
1078 pipe or over a network, saved on the active file system, or even
1079 stored in another archive. An archive file is not easy to read or
1080 manipulate without using the @code{tar} utility or Tar mode in Emacs.
1081
1082
1083 Physically, an archive consists of a series of file entries terminated
1084 by an end-of-archive entry, which consists of 512 zero bytes. A file
1085 entry usually describes one of the files in the archive (an
1086 @dfn{archive member}), and consists of a file header and the contents
1087 of the file. File headers contain file names and statistics, checksum
1088 information which @code{tar} uses to detect file corruption, and
1089 information about file types.
1090
1091 More than archive member can have the same file name. One way this
1092 situation can occur is if more than one version of a file has been
1093 stored in the archive. For information about adding new versions of a
1094 file to an archive, @pxref{Modifying}.
1095
1096 In addition to entries describing archive members, an archive may contain
1097 entries which @code{tar} itself uses to store information.
1098 @xref{Archive Label}, for an example of such an archive entry.
1099
1100 @menu
1101 * Old Style File Information:: Old Style File Information
1102 * Archive Label::
1103 * Format Variations::
1104 @end menu
1105
1106 @node Old Style File Information, Archive Label, Archive Structure, Archive Structure
1107 @section Old Style File Information
1108 @cindex Format, old style
1109 @cindex Old style format
1110 @cindex Old style archives
1111
1112 Archives record not only an archive member's contents, but also its
1113 file name or names, its access permissions, user and group, size in
1114 bytes, and last modification time. Some archives also record the file
1115 names in each archived directory, as well as other file and directory
1116 information.
1117
1118 Certain old versions of @code{tar} cannot handle additional
1119 information recorded by newer @code{tar} programs. To create an
1120 archive which can be read by these old versions, specify the
1121 @samp{--old-archive} option in conjunction with the @samp{tar --create}
1122 operation. When you specify this option, @code{tar} leaves out
1123 information about directories, pipes, fifos, contiguous files, and
1124 device files, and specifies file ownership by group and user ids
1125 instead of names.
1126
1127 The @samp{--old-archive} option is needed only if the archive must be
1128 readable by an older tape archive program which cannot handle the new format.
1129 Most @code{tar} programs do not have this limitation, so this option
1130 is seldom needed.
1131
1132 @table @samp
1133 @item --old-archive
1134 @itemx -o
1135 @itemx --old
1136 @itemx --portable
1137 @c has portability been changed to portable?
1138 Creates an archive that can be read by an old @code{tar} program.
1139 Used in conjunction with the @samp{tar --create} operation.
1140 @end table
1141
1142 @node Archive Label, Format Variations, Old Style File Information, Archive Structure
1143 @section Including a Label in the Archive
1144 @cindex Labeling an archive
1145 @cindex Labels on the archive media
1146
1147 @c !! Should the arg to --label be a quoted string?? no - ringo
1148 To avoid problems caused by misplaced paper labels on the archive
1149 media, you can include a @dfn{label} entry---an archive member which
1150 contains the name of the archive---in the archive itself. Use the
1151 @samp{--label=@var{archive-label}} option in conjunction with the
1152 @samp{--create} operation to include a label entry in the archive as it
1153 is being created.
1154
1155 If you create an archive using both @samp{--label=@var{archive-label}}
1156 and @samp{--multi-volume}, each volume of the archive will have an
1157 archive label of the form @samp{@var{archive-label} Volume @var{n}},
1158 where @var{n} is 1 for the first volume, 2 for the next, and so on.
1159 @xref{Multi-Volume Archives}, for information on creating multiple
1160 volume archives.
1161
1162 If you extract an archive using @samp{--label=@var{archive-label}},
1163 @code{tar} will print an error if the archive label doesn't match the
1164 @var{archive-label} specified, and will then not extract the archive.
1165 You can include a regular expression in @var{archive-label}, in this
1166 case only.
1167 @c >>> why is a reg. exp. useful here? (to limit extraction to a
1168 @c >>>specific group? ie for multi-volume??? -ringo
1169
1170 To find out an archive's label entry (or to find out if an archive has
1171 a label at all), use @samp{tar --list --verbose}. @code{tar} will print the
1172 label first, and then print archive member information, as in the
1173 example below:
1174
1175 @example
1176 % tar --verbose --list --file=iamanarchive
1177 V--------- 0/0 0 Mar 7 12:01 1992 iamalabel--Volume Header--
1178 -rw-rw-rw- ringo/user 40 May 21 13:30 1990 iamafilename
1179 @end example
1180
1181 @table @samp
1182 @item --label=@var{archive-label}
1183 @itemx -V @var{archive-label}
1184 Includes an @dfn{archive-label} at the beginning of the archive when
1185 the archive is being created (when used in conjunction with the
1186 @samp{tar --create} operation). Checks to make sure the archive label
1187 matches the one specified (when used in conjunction with the @samp{tar
1188 --extract} operation.
1189 @end table
1190 @c was --volume
1191
1192 @node Format Variations, , Archive Label, Archive Structure
1193 @section Format Variations
1194 @cindex Format Parameters
1195 @cindex Format Options
1196 @cindex Options to specify archive format.
1197
1198 Format parameters specify how an archive is written on the archive
1199 media. The best choice of format parameters will vary depending on
1200 the type and number of files being archived, and on the media used to
1201 store the archive.
1202
1203 To specify format parameters when accessing or creating an archive,
1204 you can use the options described in the following sections. If you
1205 do not specify any format parameters, @code{tar} uses default
1206 parameters. You cannot modify a compressed archive. If you create an
1207 archive with the @samp{--block-size} option specified (@pxref{Blocking
1208 Factor}), you must specify that block-size when operating on the
1209 archive. @xref{Matching Format Parameters}, for other examples of
1210 format parameter considerations.
1211
1212
1213 @menu
1214 * Multi-Volume Archives::
1215 * Sparse Files::
1216 * Blocking Factor::
1217 * Compressed Archives::
1218 @end menu
1219
1220 @node Multi-Volume Archives, Sparse Files, Format Variations, Format Variations
1221 @subsection Archives Longer than One Tape or Disk
1222 @cindex Multi-volume archives
1223
1224 To create an archive that is larger than will fit on a single unit of
1225 the media, use the @samp{--multi-volume} option in conjunction with the
1226 @samp{tar --create} operation (@pxref{Creating Archives}). A
1227 @dfn{multi-volume} archive can be manipulated like any other archive
1228 (provided the @samp{--multi-volume} option is specified), but is stored
1229 on more than one tape or disk.
1230
1231 When you specify @samp{--multi-volume}, @code{tar} does not report an
1232 error when it comes to the end of an archive volume (when reading), or
1233 the end of the media (when writing). Instead, it prompts you to load
1234 a new storage volume. If the archive is on a magnetic tape, you
1235 should change tapes when you see the prompt; if the archive is on a
1236 floppy disk, you should change disks; etc.
1237
1238 You can read each individual volume of a multi-volume archive as if it
1239 were an archive by itself. For example, to list the contents of one
1240 volume, use @samp{tar --list}, without @samp{--multi-volume} specified.
1241 To extract an archive member from one volume (assuming it is described
1242 that volume), use @samp{tar --extract}, again without
1243 @samp{--multi-volume}.
1244
1245 If an archive member is split across volumes (ie. its entry begins on
1246 one volume of the media and ends on another), you need to specify
1247 @samp{--multi-volume} to extract it successfully. In this case, you
1248 should load the volume where the archive member starts, and use
1249 @samp{tar --extract --multi-volume}---@code{tar} will prompt for later
1250 volumes as it needs them. @xref{Extracting From Archives} for more
1251 information about extracting archives.
1252
1253 @samp{--info-script=@var{program-file}} is like @samp{--multi-volume},
1254 except that @code{tar} does not prompt you directly to change media
1255 volumes when a volume is full---instead, @code{tar} runs commands you
1256 have stored in @var{program-file}. This option can be used to
1257 broadcast messages such as @samp{someone please come change my tape}
1258 when performing unattended backups. When @var{program-file} is done,
1259 @code{tar} will assume that the media has been changed.
1260
1261
1262 <<< There should be a sample program here, including an exit before
1263 <<< end.
1264
1265 @table @samp
1266 @item --multi-volume
1267 @itemx -M
1268 Creates a multi-volume archive, when used in conjunction with
1269 @samp{tar --create}. To perform any other operation on a multi-volume
1270 archive, specify @samp{--multi-volume} in conjunction with that
1271 operation.
1272
1273 @item --info-script=@var{program-file}
1274 @itemx -F @var{program-file}
1275 Creates a multi-volume archive via a script. Used in conjunction with
1276 @samp{tar --create}.
1277 @end table
1278
1279 @node Sparse Files, Blocking Factor, Multi-Volume Archives, Format Variations
1280 @subsection Archiving Sparse Files
1281 @cindex Sparse Files
1282
1283 A file is sparse if it contains blocks of zeros whose existance is
1284 recorded, but that have no space allocated on disk. When you specify
1285 the @samp{--sparse} option in conjunction with the @samp{--create}
1286 operation, @code{tar} tests all files for sparseness while archiving.
1287 If @code{tar} finds a file to be sparse, it uses a sparse
1288 representation of the file in the archive. @xref{Creating Archives},
1289 for more information about creating archives.
1290
1291 @samp{--sparse} is useful when archiving files, such as dbm files,
1292 likely to contain many nulls. This option dramatically
1293 decreases the amount of space needed to store such an archive.
1294
1295 @quotation
1296 @strong{Please Note:} Always use @samp{--sparse} when performing file
1297 system backups, to avoid archiving the expanded forms of files stored
1298 sparsely in the system.@refill
1299
1300 Even if your system has no no sparse files currently, some may be
1301 created in the future. If you use @samp{--sparse} while making file
1302 system backups as a matter of course, you can be assured the archive
1303 will always take no more space on the media than the files take on
1304 disk (otherwise, archiving a disk filled with sparse files might take
1305 hundreds of tapes).@refill
1306 <<< xref incremental when node name is set.
1307 @end quotation
1308
1309 @code{tar} ignores the @samp{--sparse} option when reading an archive.
1310
1311 @table @samp
1312 @item --sparse
1313 @itemx -S
1314 Files stored sparsely in the file system are represented sparsely in
1315 the archive. Use in conjunction with write operations.
1316 @end table
1317
1318 @node Blocking Factor, Compressed Archives, Sparse Files, Format Variations
1319 @subsection The Blocking Factor of an Archive
1320 @cindex Blocking Factor
1321 @cindex Block Size
1322 @cindex Number of records per block
1323 @cindex Number of bytes per block
1324 @cindex Bytes per block
1325 @cindex Records per block
1326
1327 The data in an archive is grouped into records, which are 512 bytes.
1328 Records are read and written in whole number multiples called
1329 @dfn{blocks}. The number of records in a block (ie. the size of a
1330 block in units of 512 bytes) is called the @dfn{blocking factor}. The
1331 @samp{--block-size=@var{number}} option specifies the blocking factor
1332 of an archive. The default blocking factor is typically 20 (ie.@:
1333 10240 bytes), but can be specified at installation. To find out the
1334 blocking factor of an existing archive, use @samp {tar --list
1335 --file=@var{archive-name}}. This may not work on some devices.
1336
1337 Blocks are seperated by gaps, which waste space on the archive media.
1338 If you are archiving on magnetic tape, using a larger blocking factor
1339 (and therefore larger blocks) provides faster throughput and allows
1340 you to fit more data on a tape (because there are fewer gaps). If you
1341 are archiving on cartridge, a very large blocking factor (say 126 or
1342 more) greatly increases performance. A
1343 smaller blocking factor, on the other hand, may be usefull when
1344 archiving small files, to avoid archiving lots of nulls as @code{tar}
1345 fills out the archive to the end of the block. In general, the ideal block size
1346 depends on the size of the inter-block gaps on the tape you are using,
1347 and the average size of the files you are archiving. @xref{Creating
1348 Archives}, for information on writing archives.
1349
1350 Archives with blocking factors larger than 20 cannot be read by very
1351 old versions of @code{tar}, or by some newer versions of @code{tar}
1352 running on old machines with small address spaces. With GNU
1353 @code{tar}, the blocking factor of an archive is limited only by the
1354 maximum block size of the device containing the archive, or by the
1355 amount of available virtual memory.
1356
1357 If you use a non-default blocking factor when you create an archive,
1358 you must specify the same blocking factor when you modify that
1359 archive. Some archive devices will also require you to specify the
1360 blocking factor when reading that archive, however this is not
1361 typically the case. Usually, you can use @samp{tar --list} without
1362 specifying a blocking factor---@code{tar} reports a non-default block
1363 size and then lists the archive members as it would normally. To
1364 extract files from an archive with a non-standard blocking factor
1365 (particularly if you're not sure what the blocking factor is), you can
1366 usually use the {--read-full-blocks} option while specifying a blocking
1367 factor larger then the blocking factor of the archive (ie. @samp{tar
1368 --extract --read-full-blocks --block-size=300}. @xref{Listing Contents}
1369 for more information on the @samp{--list} operation.
1370 @xref{read-full-blocks} for a more detailed explanation of that
1371 option.
1372
1373 @table @samp
1374 @item --block-size=@var{number}
1375 @itemx -b @var{number}
1376 Specifies the blocking factor of an archive. Can be used with any
1377 operation, but is usually not necessary with @samp{tar --list}.
1378 @end table
1379
1380 @node Compressed Archives, , Blocking Factor, Format Variations
1381 @subsection Creating and Reading Compressed Archives
1382 @cindex Compressed archives
1383 @cindex Storing archives in compressed format
1384
1385 @samp{--compress} indicates an archive stored in compressed format.
1386 The @samp{--compress} option is useful in saving time over networks and
1387 space in pipes, and when storage space is at a premium.
1388 @samp{--compress} causes @code{tar} to compress when writing the
1389 archive, or to uncompress when reading the archive.
1390
1391 To perform compression and uncompression on the archive, @code{tar}
1392 runs the @code{compress} utility. @code{tar} uses the default
1393 compression parameters; if you need to override them, avoid the
1394 @samp{--compress} option and run the @code{compress} utility
1395 explicitly. It is useful to be able to call the @code{compress}
1396 utility from within @code{tar} because the @code{compress} utility by
1397 itself cannot access remote tape drives.
1398
1399 The @samp{--compress} option will not work in conjunction with the
1400 @samp{--multi-volume} option or the @samp{--add-file}, @samp{--update},
1401 @samp{--add-file} and @samp{--delete} operations. @xref{Modifying}, for
1402 more information on these operations.
1403
1404 If there is no compress utility available, @code{tar} will report an
1405 error.
1406
1407 @samp{--compress-block} is like @samp{--compress}, but when used in
1408 conjunction with @samp{--create} also causes @code{tar} to pad the last
1409 block of the archive out to the next block boundary as it is written.
1410 This is useful with certain devices which require all write operations
1411 be a multiple of a specific size.
1412
1413 @quotation
1414 @strong{Please Note:} The @code{compress} program may be covered by a patent,
1415 and therefore we recommend you stop using it. We hope to have a
1416 different compress program in the future. We may change the name of
1417 this option at that time.
1418 @end quotation
1419
1420 @table @samp
1421 @item --compress
1422 @itemx --uncompress
1423 @itemx -z
1424 @itemx -Z
1425 When this option is specified, @code{tar} will compress (when writing
1426 an archive), or uncompress (when reading an archive). Used in
1427 conjunction with the @samp{--create}, @samp{--extract}, @samp{--list} and
1428 @samp{--compare} operations.
1429
1430 @item --compress-block
1431 @itemx -z -z
1432 Acts like @samp{--compress}, but pads the archive out to the next block
1433 boundary as it is written when used in conjunction with the
1434 @samp{--create} operation.
1435 @end table
1436
1437 @c >>> MIB -- why not use -Z instead of -z -z ? -ringo
1438
1439 @node Reading and Writing, Insuring Accuracy, Archive Structure, Top
1440 @chapter Reading and Writing Archives
1441
1442 The @samp{--create} operation writes a new archive, and the
1443 @samp{--extract} operation reads files from an archive and writes them
1444 into the file system. You can use other @code{tar} operations to
1445 write new information into an existing archive (adding files to it,
1446 adding another archive to it, or deleting files from it), and you can
1447 read a list of the files in an archive without extracting it using the
1448 @samp{--list} operation.
1449
1450 @menu
1451 * Archive Name:: The name of an archive
1452 * Creating in Detail:: Creating in detail
1453 * Modifying:: Modifying archives
1454 * Listing Contents:: Listing the contents of an archive
1455 * Extracting From Archives:: Extracting files from an archive
1456 @end menu
1457
1458 @node Archive Name, Creating in Detail, Reading and Writing, Reading and Writing
1459 @section The Name of an Archive
1460 @cindex Naming an archive
1461 @cindex Archive Name
1462 @cindex Directing output
1463 @cindex Where is the archive?
1464
1465 An archive can be saved as a file in the file system, sent through a
1466 pipe or over a network, or written to an I/O device such as a tape or
1467 disk drive. To specify the name of the archive, use the
1468 @samp{--file=@var{archive-name}} option.
1469
1470 An archive name can be the name of an ordinary file or the name of an
1471 I/O device. @code{tar} always needs an archive name---if you do not
1472 specify an archive name, the archive name comes from the environment
1473 variable @code{TAPE} or, if that variable is not specified, a default
1474 archive name, which is usually the name of tape unit zero (ie.
1475 /dev/tu00).
1476
1477 If you use @file{-} as an @var{archive-name}, @code{tar} reads the
1478 archive from standard input (when listing or extracting files), or
1479 writes it to standard output (when creating an archive). If you use
1480 @file{-} as an @var{archive-name} when modifying an archive,
1481 @code{tar} reads the original archive from its standard input and
1482 writes the entire new archive to its standard output.
1483
1484 @c >>> MIB--does standard input and output redirection work with all
1485 @c >>> operations?
1486 @c >>> need example for standard input and output (screen and keyboard?)
1487
1488 @cindex Standard input and output
1489 @cindex tar to standard input and output
1490
1491 To specify an archive file on a device attached to a remote machine,
1492 use the following:
1493
1494 @example
1495 --file=@var{hostname}:/@var{dev}/@var{file name}
1496 @end example
1497
1498 @noindent
1499 @code{tar} will complete the remote connection, if possible, and
1500 prompt you for a username and password. If you use
1501 @samp{--file=@@@var{hostname}:/@var{dev}/@var{file-name}}, @code{tar}
1502 will complete the remote connection, if possible, using your username
1503 as the username on the remote machine.
1504
1505 @c >>>MIB --- is this clear?
1506
1507 @table @samp
1508 @item --file=@var{archive-name}
1509 @itemx -f @var{archive-name}
1510 Names the archive to create or operate on. Use in conjunction with
1511 any operation.
1512 @end table
1513
1514 @node Creating in Detail, Modifying, Archive Name, Reading and Writing
1515 @section Creating in Detail
1516 @c operations should probably have examples, not tables.
1517 @cindex Writing new archives
1518 @cindex Archive creation
1519
1520 To create an archive, use @samp{tar --create}. To name the archive,
1521 use @samp{--file=@var{archive-name}} in conjunction with the
1522 @samp{--create} operation (@pxref{Archive Name}). If you do not name
1523 the archive, @code{tar} uses the value of the environment variable
1524 @code{TAPE} as the file name for the archive, or, if that is not
1525 available, @code{tar} uses a default archive name, usually that for tape
1526 unit zero. @xref{Archive Name}, for more information about specifying
1527 an archive name.
1528
1529 The following example creates an archive named @file{stooges},
1530 containing the files @file{larry}, @file{moe} and @file{curley}:
1531
1532 @example
1533 tar --create --file=stooges larry moe curley
1534 @end example
1535
1536 If you specify a directory name as a file-name argument, @code{tar}
1537 will archive all the files in that directory. The following example
1538 creates an archive named @file{hail/hail/fredonia}, containing the
1539 contents of the directory @file{marx}:
1540
1541 @example
1542 tar --create --file=hail/hail/fredonia marx
1543 @end example
1544
1545 If you don't specify files to put in the archive, @code{tar} archives
1546 all the files in the working directory. The following example creates
1547 an archive named @file{home} containing all the files in the working
1548 directory:
1549
1550 @example
1551 tar --create --file=home
1552 @end example
1553
1554 @xref{File Name Lists}, for other ways to specify files to archive.
1555
1556 Note: In the example above, an archive containing all the files in the
1557 working directory is being written to the working directory. GNU
1558 @code{tar} stores files in the working directory in an archive which
1559 is itself in the working directory without falling into an infinite
1560 loop. Other versions of @code{tar} may fall into this trap.
1561
1562 @node Modifying, Listing Contents, Creating in Detail, Reading and Writing
1563 @section Modifying Archives
1564 @cindex Modifying archives
1565
1566 Once an archive is created, you can add new archive members to it, add
1567 the contents of another archive, add newer versions of members already
1568 stored, or delete archive members already stored.
1569
1570 To find out what files are already stored in an archive, use @samp{tar
1571 --list --file=@var{archive-name}}. @xref{Listing Contents}.
1572
1573 @menu
1574 * Adding Files::
1575 * Appending Archives::
1576 * Deleting Archive Files:: Deleting Files From an Archive
1577 * Matching Format Parameters::
1578 @end menu
1579
1580 @node Adding Files, Appending Archives, Modifying, Modifying
1581 @subsection Adding Files to an Archive
1582 @cindex Adding files to an archive
1583 @cindex Updating an archive
1584
1585 To add files to an archive, use @samp{tar --add-file}. The archive to
1586 be added to must already exist and be in proper archive format (which
1587 normally means it was created previously using @code{tar}). If the
1588 archive was created with a different block size than now specified,
1589 @code{tar} will report an error (@pxref{Blocking Factor}). If the
1590 archive is not a valid @code{tar} archive, the results will be
1591 unpredictable. You cannot add files to a compressed archive, however
1592 you can add files to the last volume of a multi-volume archive.
1593 @xref{Matching Format Parameters}.
1594
1595 The following example adds the file @file{shemp} to the archive
1596 @file{stooges} created above:
1597
1598 @example
1599 tar --add-file --file=stooges shemp
1600 @end example
1601
1602 You must specify the files to be added; there is no default.
1603
1604 @samp{tar --update} acts like @samp{tar --add-file}, but does not add
1605 files to the archive if there is already a file entry with that name
1606 in the archive that has the same modification time.
1607
1608 Both @samp{--update} and @samp{--add-file} work by adding to the end of
1609 the archive. When you extract a file from the archive, only the
1610 version stored last will wind up in the file system. Because
1611 @samp{tar --extract} extracts files from an archive in sequence, and
1612 overwrites files with the same name in the file system, if a file name
1613 appears more than once in an archive the last version of the file will
1614 overwrite the previous versions which have just been extracted. You
1615 should avoid storing older versions of a file later in the archive.
1616
1617 Note: @samp{--update} is not suitable for performing backups, because
1618 it doesn't change directory content entries, and because it lengthens
1619 the archive every time it is used.
1620 @c <<< xref to scripted backup, listed incremental, for info on backups.
1621
1622 @node Appending Archives, Deleting Archive Files, Adding Files, Modifying
1623 @subsection Appending One Archive's Contents to Another Archive
1624 @cindex Adding archives to an archive
1625 @cindex Concatenating Archives
1626
1627 To append copies of an archive or archives to the end of another
1628 archive, use @samp{tar --add-archive}. The source and target archives
1629 must already exist and have been created using compatable format
1630 parameters (@pxref{Matching Format Parameters}).
1631
1632 @code{tar} will stop reading an archive if it encounters an
1633 end-of-archive marker. The @code{cat} utility does not remove
1634 end-of-archive markers, and is therefore unsuitable for concatenating
1635 archives. @samp{tar --add-archive} removes the end-of-archive marker
1636 from the target archive before each new archive is appended.
1637 @c <<< xref ignore-zeros
1638
1639 You must specify the source archives using
1640 @samp{--file=@var{archive-name}} (@pxref{Archive Name}). If you do not
1641 specify the target archive , @code{tar} uses the value of the
1642 environment variable @code{TAPE}, or, if this has not been set, the
1643 default archive name.
1644
1645 The following example adds the contents of the archive
1646 @file{hail/hail/fredonia} to the archive @file{stooges} (both archives
1647 were created in examples above):
1648
1649 @example
1650 tar --add-archive --file=stooges hail/hail/fredonia
1651 @end example
1652
1653 If you need to retrieve files from an archive that was added to using
1654 the @code{cat} utility, use the @samp{--ignore-zeros} option
1655 (@pxref{Archive Reading Options}).
1656
1657 @node Deleting Archive Files, Matching Format Parameters, Appending Archives, Modifying
1658 @subsection Deleting Files From an Archive
1659 @cindex Deleting files from an archive
1660 @cindex Removing files from an archive
1661
1662 To delete archive members from an archive, use @samp{tar --delete}.
1663 You must specify the file names of the members to be deleted. All
1664 archive members with the specified file names will be removed from the
1665 archive.
1666
1667 The following example removes the file @file{curley} from the archive
1668 @file{stooges}:
1669
1670 @example
1671 tar --delete --file=stooges curley
1672 @end example
1673
1674 You can only use @samp{tar --delete} on an archive if the archive
1675 device allows you to write to any point on the media.
1676
1677 @quotation
1678 @strong{Warning:} Don't try to delete an archive member from a
1679 magnetic tape, lest you scramble the archive. There is no safe way
1680 (except by completely re-writing the archive) to delete files from
1681 most kinds of magnetic tape.
1682 @end quotation
1683
1684 @c <<< MIB -- how about automatic detection of archive media? give error
1685 @c <<< unless the archive device is either an ordinary file or different
1686 @c <<< input and output (--file=-).
1687
1688 @node Matching Format Parameters, , Deleting Archive Files, Modifying
1689 @subsection Matching the Format Parameters
1690
1691 Some format parameters must be taken into consideration when modifying
1692 an archive:
1693
1694 Compressed archives cannot be modified.
1695
1696 You have to specify the block size of the archive when modifying an
1697 archive with a non-default block size.
1698
1699 Multi-volume archives can be modified like any other archive. To add
1700 files to a multi-volume archive, you need to only mount the last
1701 volume of the archive media (and new volumes, if needed). For all
1702 other operations, you need to use the entire archive.
1703
1704 If a multi-volume archive was labeled using @samp{--label}
1705 (@pxref{Archive Label}) when it was created, @code{tar} will not
1706 automatically label volumes which are added later. To label
1707 subsequent volumes, specify @samp{--label=@var{archive-label}} again in
1708 conjunction with the @samp{--add-file}, @samp{--update} or
1709 @samp{--add-archive} operation.
1710 @cindex Labelling multi-volume archives
1711 @c <<< example
1712
1713 @c <<< xref somewhere, for more information about format parameters.
1714
1715 @node Listing Contents, Extracting From Archives, Modifying, Reading and Writing
1716 @section Listing the Contents of an Archive
1717 @cindex Names of the files in an archive
1718 @cindex Archive contents, list of
1719 @cindex Archive members, list of
1720
1721 @samp{tar --list} prints a list of the file names of the archive
1722 members on the standard output. If you specify @var{file-name}
1723 arguments on the command line (or using the @samp{--files-from} option,
1724 @pxref{File Name Lists}), only the files you specify will be listed,
1725 and only if they exist in the archive. Files not specified will be
1726 ignored, unless they are under a specific directory.
1727
1728 If you include the @samp{--verbose} option, @code{tar} prints an
1729 @samp{ls -l} type listing for the archive. @pxref{Additional
1730 Information}, for a description of the @samp{--verbose} option.
1731
1732 If the blocking factor of the archive differs from the default,
1733 @code{tar} reports this. @xref{Blocking Factor}.
1734
1735 @xref{Archive Reading Options} for a list of options which can be used
1736 to modify @samp{--list}'s operation.
1737
1738 This example prints a list of the archive members of the archive
1739 @file{stooges}:
1740
1741 @example
1742 tar --list --file=stooges
1743 @end example
1744
1745 @noindent
1746 @code{tar} responds:
1747
1748 @example
1749 larry
1750 moe
1751 shemp
1752 marx/julius
1753 marx/alexander
1754 marx/karl
1755 @end example
1756
1757 This example generates a verbose list of the archive members of the
1758 archive file @file{dwarves}, which has a blocking factor of two:
1759
1760 @example
1761 tar --list -v --file=blocks
1762 @end example
1763
1764 @noindent
1765 @code{tar} responds:
1766
1767 @example
1768 tar: Blocksize = 2 records
1769 -rw------- ringo/user 42 May 1 13:29 1990 .bashful
1770 -rw-rw-rw- ringo/user 42 Oct 4 13:29 1990 doc
1771 -rw-rw-rw- ringo/user 42 Jul 20 18:01 1969 dopey
1772 -rw-rw---- ringo/user 42 Nov 26 13:42 1963 grumpy
1773 -rw-rw-rw- ringo/user 42 May 5 13:29 1990 happy
1774 -rw-rw-rw- ringo/user 42 May 1 12:00 1868 sleepy
1775 -rw-rw-rw- ringo/user 42 Jul 4 17:29 1776 sneezy
1776 @end example
1777
1778 @node Extracting From Archives, , Listing Contents, Reading and Writing
1779 @section Extracting Files from an Archive
1780 @cindex Extraction
1781 @cindex Retrieving files from an archive
1782 @cindex Resurrecting files from an archive
1783
1784 To read archive members from the archive and write them into the file
1785 system, use @samp{tar --extract}. The archive itself is left
1786 unchanged.
1787
1788 If you do not specify the files to extract, @code{tar} extracts all
1789 the files in the archive. If you specify the name of a directory as a
1790 file-name argument, @code{tar} will extract all files which have been
1791 stored as part of that directory. If a file was stored with a
1792 directory name as part of its file name, and that directory does not
1793 exist under the working directory when the file is extracted,
1794 @code{tar} will create the directory. @xref{Selecting Archive
1795 Members}, for information on specifying files to extract.
1796
1797 The following example shows the extraction of the archive
1798 @file{stooges} into an empty directory:
1799
1800 @example
1801 tar --extract --file=stooges
1802 @end example
1803
1804 @noindent
1805 Generating a listing of the directory (@samp{ls}) produces:
1806
1807 @example
1808 larry
1809 moe
1810 shemp
1811 marx
1812 @end example
1813
1814 @noindent
1815 The subdirectory @file{marx} contains the files @file{julius},
1816 @file{alexander} and @file{karl}.
1817
1818 If you wanted to just extract the files in the subdirectory
1819 @file{marx}, you could specify that directory as a file-name argument
1820 in conjunction with the @samp{--extract} operation:
1821
1822 @example
1823 tar --extract --file=stooges marx
1824 @end example
1825
1826 @quotation
1827 @strong{Warning:} Extraction can overwrite files in the file system.
1828 To avoid losing files in the file system when extracting files from
1829 the archive with the same name, use the @samp{--keep-old-files} option
1830 (@pxref{File Writing Options}).
1831 @end quotation
1832
1833 If the archive was created using @samp{--block-size}, @samp{--compress}
1834 or @samp{--multi-volume}, you must specify those format options again
1835 when extracting files from the archive (@pxref{Format Variations}).
1836
1837 @menu
1838 * Archive Reading Options::
1839 * File Writing Options::
1840 * Scarce Disk Space:: Recovering From Scarce Disk Space
1841 @end menu
1842
1843 @node Archive Reading Options, File Writing Options, Extracting From Archives, Extracting From Archives
1844 @subsection Options to Help Read Archives
1845 @cindex Options when reading archives
1846 @cindex Reading incomplete blocks
1847 @cindex Blocks, incomplete
1848 @cindex End of archive markers, ignoring
1849 @cindex Ignoring end of archive markers
1850 @cindex Large lists of file names on small machines
1851 @cindex Small memory
1852 @cindex Running out of space
1853
1854 @c <<< each option wants its own node. summary after menu
1855
1856 Normally, @code{tar} will request data in full block increments from
1857 an archive storage device. If the device cannot return a full block,
1858 @code{tar} will report an error. However, some devices do not always
1859 return full blocks, or do not require the last block of an archive to
1860 be padded out to the next block boundary. To keep reading until you
1861 obtain a full block, or to accept an incomplete block if it contains
1862 an end-of-archive marker, specify the @samp{--read-full-blocks} option
1863 in conjunction with the @samp{--extract} or @samp{--list} operations.
1864 @xref{Listing Contents}.
1865
1866 The @samp{--read-full-blocks} option is turned on by default when
1867 @code{tar} reads an archive from standard input, or from a remote
1868 machine. This is because on BSD Unix systems, attempting to read a
1869 pipe returns however much happens to be in the pipe, even if it is
1870 less than was requested. If this option were not enabled, @code{tar}
1871 would fail as soon as it read an incomplete block from the pipe.
1872
1873 If you're not sure of the blocking factor of an archive, you can read
1874 the archive by specifying @samp{--read-full-blocks} and
1875 @samp{--block-size=@var{n}}, where @var{n} is a blocking factor larger
1876 than the blocking factor of the archive. This lets you avoid having
1877 to determine the blocking factor of an archive. @xref{Blocking
1878 Factor}.
1879
1880 @table @samp
1881 @item --read-full-blocks
1882 @item -B
1883 Use in conjunction with @samp{tar --extract} to read an archive which
1884 contains incomplete blocks, or one which has a blocking factor less
1885 than the one specified.
1886 @end table
1887
1888 Normally @code{tar} stops reading when it encounters a block of zeros
1889 between file entries (which usually indicates the end of the archive).
1890 @samp{--ignore-zeros} allows @code{tar} to completely read an archive
1891 which contains a block of zeros before the end (i.e.@: a damaged
1892 archive, or one which was created by @code{cat}-ing several archives
1893 together).
1894
1895 The @samp{--ignore-zeros} option is turned off by default because many
1896 versions of @code{tar} write garbage after the end of archive entry,
1897 since that part of the media is never supposed to be read. GNU
1898 @code{tar} does not write after the end of an archive, but seeks to
1899 maintain compatablity among archiving utilities.
1900
1901 @table @samp
1902 @item --ignore-zeros
1903 @itemx -i
1904 To ignore blocks of zeros (ie.@: end-of-archive entries) which may be
1905 encountered while reading an archive. Use in conjunction with
1906 @samp{tar --extract} or @samp{tar --list}.
1907 @end table
1908
1909 If you are using a machine with a small amount of memory, and you need
1910 to process large list of file-names, you can reduce the amount of
1911 space @code{tar} needs to process the list. To do so, specify the
1912 @samp{--same-order} option and provide an ordered list of file names.
1913 This option tells @code{tar} that the @file{file-name} arguments
1914 (provided on the command line, or read from a file using the
1915 @samp{--files-from} option) are listed in the same order as the files
1916 in the archive.
1917
1918 You can create a file containing an ordered list of files in the
1919 archive by storing the output produced by @samp{tar --list
1920 --file=@var{archive-name}}. @xref{Listing Contents}, for information
1921 on the @samp{--list} operation.
1922
1923 This option is probably never needed on modern computer systems.
1924
1925 @table @samp
1926 @item --same-order
1927 @itemx --preserve-order
1928 @itemx -s
1929 To process large lists of file-names on machines with small amounts of
1930 memory. Use in conjunction with @samp{tar --compare}, @samp{tar --list}
1931 or @samp{tar --extract}.
1932 @end table
1933
1934 @c we don't need/want --preserve to exist any more
1935
1936 @node File Writing Options, Scarce Disk Space, Archive Reading Options, Extracting From Archives
1937 @subsection Changing How @code{tar} Writes Files
1938 @c <<< find a better title
1939 @cindex Overwriting old files, prevention
1940 @cindex Protecting old files
1941 @cindex Modification times of extracted files
1942 @cindex Permissions of extracted files
1943 @cindex Modes of extracted files
1944 @cindex Writing extracted files to standard output
1945 @cindex Standard output, writing extracted files to
1946
1947 Normally, @code{tar} writes extracted files into the file system
1948 without regard to the files already on the system---files with the
1949 same name as archive members are overwritten. To prevent @code{tar}
1950 from extracting an archive member from an archive, if doing so will
1951 overwrite a file in the file system, use @samp{--keep-old-files} in
1952 conjunction with the @samp{--extract} operation. When this option is
1953 specified, @code{tar} reports an error stating the name of the files
1954 in conflict, instead of writing the file from the archive.
1955
1956 @table @samp
1957 @item --keep-old files
1958 @itemx -k
1959 Prevents @code{tar} from overwriting files in the file system during
1960 extraction.
1961 @end table
1962
1963 Normally, @code{tar} sets the modification times of extracted files to
1964 the modification times recorded for the files in the archive, but
1965 limits the permissions of extracted files by the current @code{umask}
1966 setting.
1967
1968 To set the modification times of extracted files to the time when
1969 the files were extracted, use the @samp{--modification-time} option in
1970 conjunction with @samp{tar --extract}.
1971
1972 @table @samp
1973 @item --modification-time
1974 @itemx -m
1975 Sets the modification time of extracted archive members to the time
1976 they were extracted, not the time recorded for them in the archive.
1977 Use in conjunction with @samp{--extract}.
1978 @end table
1979
1980 To set the modes (access permissions) of extracted files to those
1981 recorded for those files in the archive, use the
1982 @samp{--preserve-permissions} option in conjunction with the
1983 @samp{--extract} operation.
1984 @c <<<mib --- should be aliased to ignore-umask.
1985
1986 @table @samp
1987 @item --preserve-permission
1988 @itemx --same-permission
1989 @itemx --ignore-umask
1990 @itemx -p
1991 Set modes of extracted archive members to those recorded in the
1992 archive, instead of current umask settings. Use in conjunction with
1993 @samp{--extract}.
1994 @end table
1995
1996 @c <<< following paragraph needs to be rewritten:
1997 @c <<< why doesnt' this cat files together, why is this useful. is it
1998 @c <<< really useful with more than one file?
1999 To write the files extracted to the standard output, instead of
2000 creating the files on the file system, use @samp{--to-stdout} in
2001 conjunction with @samp{tar --extract}. This option is useful if you
2002 are extracting files to send them through a pipe, and do not need to
2003 preserve them in the file system.
2004
2005 @table @samp
2006 @item --to-stdout
2007 @itemx -O
2008 Writes files to the standard output. Used in conjunction with
2009 @samp{--extract}.
2010 @end table
2011
2012 @c <<< why would you want to do such a thing, how are files separated on
2013 @c <<< the standard output? is this useful with more that one file? are
2014 @c <<< pipes the real reason?
2015
2016 @node Scarce Disk Space, , File Writing Options, Extracting From Archives
2017 @subsection Recovering From Scarce Disk Space
2018 @cindex Middle of the archive, starting in the
2019 @cindex Running out of space during extraction
2020 @cindex Disk space, running out of
2021 @cindex Space on the disk, recovering from lack of
2022
2023 If a previous attempt to extract files failed due to lack of disk
2024 space, you can use @samp{--starting-file=@var{file-name}} to start
2025 extracting only after file @var{file-name} when extracting files from
2026 the archive. This assumes, of course, that there is now free space,
2027 or that you are now extracting into a different file system.
2028
2029 @table @samp
2030 @item --starting-file=@var{file-name}
2031 @itemx -K @var{file-name}
2032 Starts an operation in the middle of an archive. Use in conjunction
2033 with @samp{--extract} or @samp{--list}.
2034 @end table
2035
2036 If you notice you are running out of disk space during an extraction
2037 operation, you can also suspend @code{tar}, remove unnecessary files
2038 from the file system, and then restart the same @code{tar} operation.
2039 In this case, @samp{--starting-file} is not necessary.
2040
2041 @c <<< xref incremental, xref --interactive, xref --exclude
2042
2043 @node Insuring Accuracy, Selecting Archive Members, Reading and Writing, Top
2044 @chapter Insuring the Accuracy of an Archive
2045
2046 You can insure the accuracy of an archive by comparing files in the
2047 system with archive members. @code{tar} can compare an archive to the
2048 file system as the archive is being written, to verify a write
2049 operation, or can compare a previously written archive, to insure that
2050 it is up to date.
2051
2052 @menu
2053 * Write Verification::
2054 * Comparing::
2055 @end menu
2056
2057 @node Write Verification, Comparing, Insuring Accuracy, Insuring Accuracy
2058 @section Verifying Data as It is Stored
2059 @cindex Verifying a write operation
2060 @cindex Double-checking a write operation
2061
2062 To check for discrepancies in an archive immediately after it is
2063 written, use the @samp{--verify} option in conjunction with the
2064 @samp{tar --create} operation. When this option is specified,
2065 @code{tar} checks archive members against their counterparts in the file
2066 system, and reports discrepancies on the standard error. In
2067 multi-volume archives, each volume is verified after it is written,
2068 before the next volume is written.
2069
2070 To verify an archive, you must be able to read it from before the end
2071 of the last written entry. This option is useful for detecting data
2072 errors on some tapes. Archives written to pipes, some cartridge tape
2073 drives, and some other devices cannot be verified.
2074
2075 @table @samp
2076 @item --verify
2077 @itemx -W
2078 Checks for discrepancies in the archive immediately after it is
2079 written. Use in conjunction with @samp{tar --create}.
2080 @end table
2081
2082 @node Comparing, , Write Verification, Insuring Accuracy
2083 @section Comparing an Archive with the File System
2084 @cindex Verifying the currency of an archive
2085
2086 @samp{tar --compare} compares archive members in an existing archive
2087 with their counterparts in the file system, and reports differences in
2088 file size, mode, owner, modification date and contents. If a file is
2089 represented in the archive but does not exist in the file system,
2090 @code{tar} reports a difference.
2091
2092 If you use @var{file-name} arguments in conjunction with @samp{tar
2093 --compare}, @code{tar} compares the archived versions of the files
2094 specified with their counterparts in the file system. If you specify
2095 a file that is not in the archive, @code{tar} will report an error. If
2096 you don't specify any files, @code{tar} compares all the files in the
2097 archive.
2098
2099 Because @code{tar} only checks files in the archive against files in
2100 the file system, and not vice versa, it ignores files in the file
2101 system that do not exist in the archive.
2102
2103 The following example compares the archive members @file{larry},
2104 @file{moe} and @file{curly} in the archive @file{stooges} with files
2105 of the same name in the file system.
2106
2107 @example
2108 tar --compare --file=stooges larry moe curly
2109 @end example
2110
2111 @noindent
2112 If a file, for example @file{curly}, did not exist in the archive,
2113 @code{tar} would report an error, as follows:
2114
2115 @example
2116 curly: does not exist
2117 @end example
2118
2119 @node Selecting Archive Members, User Interaction, Insuring Accuracy, Top
2120 @chapter Selecting Archive Members
2121 @cindex Specifying files to act on
2122 @cindex Specifying archive members
2123
2124 @dfn{File-name arguments} specify which files in the file system
2125 @code{tar} operates on, when creating or adding to an archive, or
2126 which archive members @code{tar} operates on, when reading or
2127 deleting from an archive. (@pxref{Reading and Writing}.)
2128
2129 To specify file names, you can include them as the last arguments on
2130 the command line, as follows:
2131 @example
2132 tar @var{operation} [@var{option1} @var{option2} ..] [@var{file-name-1} @var{file-name-2} ...]
2133 @end example
2134
2135 If you specify a directory name as a file name argument, all the files
2136 in that directory are operated on by @code{tar}.
2137
2138 If you do not specify files when @code{tar} is invoked, @code{tar}
2139 operates on all the non-directory files in the working directory (if
2140 the operation is @samp{--create}), all the archive members in the
2141 archive (if a read operation is specified), or does nothing (if any
2142 other operation is specified).
2143
2144 @menu
2145 * File Name Lists:: Reading File Names from a File
2146 * File Name Interpretation:: this needs a better title
2147 * File Exclusion:: so does this
2148 @end menu
2149
2150 @node File Name Lists, File Name Interpretation, Selecting Archive Members, Selecting Archive Members
2151 @section Reading a List of File Names from a File
2152 @cindex Lists of file names
2153 @cindex File-name arguments, alternatives
2154
2155 To read file names from a file on the file system, instead of from the
2156 command line, use the @samp{--files-from=@var{file}} option. If you
2157 specify @samp{-} as @var{file}, the file names are read from standard
2158 input. Note that using both @samp{--files-from=-} and @samp{--file=-}
2159 in the same command will not work unless the operation is
2160 @samp{--create}. @xref{Archive Name}, for an explanation of the
2161 @samp{--file} option.
2162
2163 @table @samp
2164 @item --files-from=@var{file}
2165 @itemx -T @var{file}
2166 Reads file-name arguments from a file on the file system, instead of
2167 from the command line. Use in conjunction with any operation.
2168 @end table
2169
2170 @node File Name Interpretation, File Exclusion, File Name Lists, Selecting Archive Members
2171 @section File Name Interpretation
2172 @cindex File Names, interpreting
2173
2174 @c <<<<add some text -ringo
2175
2176 @menu
2177 * Absolute File Names::
2178 * Changing Working Directory::
2179 * Archiving with Symbolic Links:: Archiving Using Symbolic Links
2180 @end menu
2181
2182 @node Absolute File Names, Changing Working Directory, File Name Interpretation, File Name Interpretation
2183 @subsection Storing and Extracting Files Relative to Root
2184
2185 @c <<< is this what this does, or does it just preserve the slash?
2186 @c <<< is it still called --absolute-paths?
2187
2188 @c To archive or extract files relative to the root directory, specify
2189 @c the @samp{--absolute-paths} option.
2190
2191 @c Normally, @code{tar} acts on files relative to the working
2192 @c directory---ignoring superior directory names when archiving, and
2193 @c ignoring leading slashes when extracting.
2194
2195 @c When you specify @samp{--absolute-paths}, @code{tar} stores file names
2196 @c including all superior directory names, and preserves leading slashes.
2197 @c If you only invoked @code{tar} from the root directory you would never
2198 @c need the @samp{--absolute-paths} option, but using this option may be
2199 @c more convenient than switching to root.
2200
2201 @c >>> should be an example in the tutorial/wizardry section using this
2202 @c >>> to transfer files between systems.
2203
2204 @c >>> is write access an issue?
2205
2206 @table @samp
2207 @item --absolute-paths
2208 Preserves full file names (inclusing superior dirctory names) when
2209 archiving files. Preserves leading slash when extracting files.
2210 @end table
2211
2212 @node Changing Working Directory, Archiving with Symbolic Links, Absolute File Names, File Name Interpretation
2213 @subsection Changing the Working Directory Within a List of File-names
2214 @cindex Directory, changing in mid-stream
2215 @cindex Working directory, specifying
2216
2217 To change working directory in the middle of a list of file names,
2218 (either on the command line or in a file specified using
2219 @samp{--files-from}), use @samp{--directory=@var{directory}}. This will
2220 change the working directory to the directory @var{directory} after
2221 that point in the list. For example,
2222
2223 @example
2224 tar --create iggy ziggy --directory=baz melvin
2225 @end example
2226
2227 @noindent
2228 will place the files @file{iggy} and @file{ziggy} from the current
2229 directory into the archive, followed by the file @file{melvin} from
2230 the directory @file{baz}. This option is especially useful when you
2231 have several widely separated files that you want to store in the same
2232 directory in the archive.
2233
2234 Note that the file @file{melvin} is recorded in the archive under the
2235 precise name @file{melvin}, @emph{not} @file{baz/melvin}. Thus, the
2236 archive will contain three files that all appear to have come from the
2237 same directory; if the archive is extracted with plain @samp{tar
2238 --extract}, all three files will be written in the current directory.
2239
2240 Contrast this with the command
2241
2242 @example
2243 tar -c iggy ziggy bar/melvin
2244 @end example
2245
2246 @noindent
2247 which records the third file in the archive under the name
2248 @file{bar/melvin} so that, if the archive is extracted using @samp{tar
2249 --extract}, the third file will be written in a subdirectory named
2250 @file{bar}.
2251
2252 @table @samp
2253 @item --directory=@file{directory}
2254 @itemx -C @file{directory}
2255 Changes the working directory.
2256 @end table
2257
2258 @c <<<need to test how extract deals with this, and add an example -ringo
2259
2260 @node Archiving with Symbolic Links, , Changing Working Directory, File Name Interpretation
2261 @subsection Archiving Using Symbolic Links
2262 @cindex File names, using symbolic links
2263 @cindex Symbolic link as file name
2264
2265 @samp{--dereference} is used with @samp{tar --create}, and causes
2266 @code{tar} to archive files which are referenced by a symbolic link,
2267 using the name of the link as the file name.
2268
2269 <<<this needs to be checked by MIB and then re-written, with an example
2270 The name under which the file is stored in the file system is not
2271 recorded in the archive. To record both the symbolic link name and
2272 the file name in the system, archive the file under both names. If
2273 all links were recorded automatically by @code{tar}, an extracted file
2274 might be linked to a file name that no longer exists in the file
2275 system.
2276
2277 @c <<< is the following still true? - ringo
2278 If a linked-to file is encountered again by @code{tar} while creating
2279 the same archive, an entire second copy of it will be stored. This
2280 could be considered a bug.
2281
2282 @table @samp
2283 @item --dereference
2284 @itemx -h
2285 Stores files referenced by a symbolic link, using the name of the link
2286 as the file name. Use in conjunction with any write operation.
2287 @end table
2288
2289 @node File Exclusion, , File Name Interpretation, Selecting Archive Members
2290 @section Selecting Files by Characteristic
2291 @cindex File names, excluding files by
2292 @cindex Excluding files by name and pattern
2293 @cindex Excluding files by file system
2294 @cindex File system boundaries, not crossing
2295 @cindex Excluding file by age
2296 @cindex Modification time, excluding files by
2297 @cindex Age, excluding files by
2298
2299 To avoid crossing file system boundaries when archiving parts of a
2300 directory tree, use @samp{--one-file-system}. This option only affects
2301 files that are archived because they are in a directory that is being
2302 archived; files explicitly named on the command line are archived
2303 regardless of where they reside.
2304
2305 This option is useful for making full or incremental archival backups
2306 of a file system.
2307
2308 If this option is used in conjunction with @samp{--verbose}, files that
2309 are excluded are mentioned by name on the standard error.
2310
2311 @table @samp
2312 @item --one-file-system
2313 @itemx -l
2314 Prevents @code{tar} from crossing file system boundaries when
2315 archiving. Use in conjunction with any write operation.
2316 @end table
2317
2318 To avoid operating on files whose names match a particular pattern,
2319 use the @samp{--exclude=@var{pattern}} or
2320 @samp{--exclude-from=@var{file}} options.
2321
2322 When you specify the @samp{--exclude=@var{pattern}} option, @code{tar}
2323 ignores files which match the @var{pattern}, which can be a single
2324 file name or a more complex expression. Thus, if you invoke
2325 @code{tar} with @samp{tar --create --exclude=*.o}, no files whose names
2326 end in @file{.o} are included in the archive.
2327 @c <<< what other things can you use besides "*"?
2328
2329 @samp{--exclude-from=@var{file}} acts like @samp{--exclude}, but
2330 specifies a file @var{file} containing a list of patterns. @code{tar}
2331 ignores files with names that fit any of these patterns.
2332
2333 You can use either option more than once in a single command.
2334
2335 @table @samp
2336 @item --exclude=@var{pattern}
2337 Causes @code{tar} to ignore files that match the @var{pattern}.
2338
2339 @item --exclude-from=@var{file}
2340 Causes @code{tar} to ignore files that match the patterns listed in
2341 @var{file}.
2342 @end table
2343 @c --exclude-from used to be "--exclude", --exclude didn't used to exist.
2344
2345 To operate only on files with modification or status-change times
2346 after a particular date, use @samp{--after-date=@var{date}}. You can
2347 use this option with @samp{tar --create} or @samp{tar --add-file} to
2348 insure only new files are archived, or with @samp{tar --extract} to
2349 insure only recent files are resurrected. @refill
2350 @c --after-date @var{date} or --newer @var{date}
2351
2352 @samp{--newer-mtime=@var{date}} acts like @samp{--after-date=@var{date}},
2353 but tests just the modification times of the files, ignoring
2354 status-change times.
2355
2356 @c <<<need example of --newer-mtime with quoted argument
2357 Remember that the entire date argument should be quoted if it contains
2358 any spaces.
2359
2360
2361 @strong{Please Note:} @samp{--after-date} and @samp{--newer-mtime}
2362 should not be used for incremental backups. Some files (such as those
2363 in renamed directories) are not selected up properly by these options.
2364 @c xref to incremental backup chapter when node name is decided.
2365
2366 @table @samp
2367 @item --after-date=@var{date}
2368 @itemx --newer=@var{date}
2369 @itemx -N @var{date}
2370 Acts on files only if their modification or inode-changed times are
2371 later than @var{date}. Use in conjunction with any operation.
2372 @item --newer-mtime=@var{date}
2373 Acts like @samp{--after-date}, but only looks at modification times.
2374 @end table
2375
2376 @c <<< following is the getdate date format --- needs to be re-written,
2377 @c <<< made a sub-node:
2378
2379 Time/Date Formats Accepted by getdate
2380 (omitting obscure constructions)
2381
2382 The input consists of one or more of: time zone day date year
2383 in any order.
2384
2385 Those in turn consist of (`|' and `/' mean `or', `[]' means `optional'):
2386
2387 time: H am/pm | H:M [am/pm] | H:M:S [am/pm]
2388 zone: timezone-name | timezone-name dst
2389 day: day-name | day-name, | N day-name
2390 date: M/D | M/D/Y | month-name D | month-name D, Y | D month-name | D month-name Y
2391 year: Y
2392
2393 am can also be a.m., pm can also be p.m.
2394 case and spaces around punctuation are not significant.
2395 month and day names can be abbreviated. >>>
2396
2397 @node User Interaction, Backups and Restoration, Selecting Archive Members, Top
2398 @chapter User Interaction
2399 @cindex Getting more information during the operation
2400 @cindex Information during operation
2401 @cindex Feedback from @code{tar}
2402
2403 Once you have typed a @code{tar}command, it is usually performed
2404 without any further information required of the user, or provided by
2405 @code{tar}. The following options allow you to generate progress and
2406 status information during an operation, or to confirm operations on
2407 files as they are performed.
2408
2409 @menu
2410 * Additional Information::
2411 * Interactive Operation::
2412 @end menu
2413
2414 @node Additional Information, Interactive Operation, User Interaction, User Interaction
2415 @section Progress and Status Information
2416 @cindex Progress information
2417 @cindex Status information
2418 @cindex Information on progress and status of operations
2419 @cindex Verbose operation
2420 @cindex Record number where error occured
2421 @cindex Error message, record number of
2422 @cindex Version of the @code{tar} program
2423
2424 Typically, @code{tar} performs most operations without reporting any
2425 information to the user except error messages. If you have
2426 encountered a problem when operating on an archive, however, you may
2427 need more information than just an error message in order to solve the
2428 problem. The following options can be helpful diagnostic tools.
2429
2430 When used with most operations, @samp{--verbose} causes @code{tar} to
2431 print the file names of the files or archive members it is operating
2432 on. When used with @samp{tar --list}, the verbose option causes
2433 @code{tar} to print out an @samp{ls -l} type listing of the files in
2434 the archive.
2435
2436 Verbose output appears on the standard output except when an archive
2437 is being written to the standard output (as with @samp{tar --create
2438 --file=- --verbose}). In that case @code{tar} writes verbose output to
2439 the standard error stream.
2440
2441 @table @samp
2442 @item --verbose
2443 @itemx -v
2444 Prints the names of files or archive members as they are being
2445 operated on. Can be used in conjunction with any operation. When
2446 used with @samp{--list}, generates an @samp{ls -l} type listing.
2447 @end table
2448
2449 To find out where in an archive a message was triggered, use
2450 @samp{--record-number}. @samp{--record-number} causes @code{tar} to
2451 print, along with every message it produces, the record number within
2452 the archive where the message was triggered.
2453
2454 This option is especially useful when reading damaged archives, since
2455 it helps pinpoint the damaged sections. It can also be used with
2456 @samp{tar --list} when listing a file-system backup tape, allowing you
2457 to choose among several backup tapes when retrieving a file later, in
2458 favor of the tape where the file appears earliest (closest to the
2459 front of the tape).
2460 @c <<< xref when the node name is set and the backup section written
2461
2462 @table @samp
2463 @item --record-number
2464 @itemx -R
2465 Prints the record number whenever a message is generated by
2466 @code{tar}. Use in conjunction with any operation.
2467 @end table
2468
2469 @c rewrite below
2470 To print the version number of the @code{tar} program, use @samp{tar
2471 --version}. @code{tar} prints the version number to the standard
2472 error. For example:
2473
2474 @example
2475 tar --version
2476 @end example
2477
2478 @noindent
2479 might return:
2480
2481 @example
2482 GNU tar version 1.09
2483 @end example
2484 @c used to be an option. has been fixed.
2485
2486 @node Interactive Operation, , Additional Information, User Interaction
2487 @section Asking for Confirmation During Operations
2488 @cindex Interactive operation
2489
2490 Typically, @code{tar} carries out a command without stopping for
2491 further instructions. In some situations however, you
2492 may want to exclude some files and archive members from the operation
2493 (for instance if disk or storage space is tight). You can do this by
2494 excluding certain files automatically (@pxref{File Exclusion}), or by
2495 performing an operation interactively, using the @samp{--interactive}
2496 operation.
2497
2498 When the @samp{--interactive} option is specified, @code{tar} asks for
2499 confirmation before reading, writing, or deleting each file it
2500 encounters while carrying out an operation. To confirm the action you
2501 must type a line of input beginning with @samp{y}. If your input line
2502 begins with anything other than @samp{y}, @code{tar} skips that file.
2503
2504 Commands which might be useful to perform interactively include
2505 appending files to an archive, extracting files from an archive,
2506 deleting a file from an archive, and deleting a file from disk during
2507 an incremental restore.
2508
2509 If @code{tar} is reading the archive from the standard input,
2510 @code{tar} opens the file @file{/dev/tty} to support the interactive
2511 communications.
2512 <<< this aborts if you won't OK the working directory. this is a bug. -ringo
2513
2514 @table @samp
2515 @item --interactive
2516 @itemx --confirmation
2517 @itemx -w
2518 Asks for confirmation before reading, writing or deleting an archive
2519 member (when listing, comparing or writing an archive or deleting
2520 archive members), or before writing or deleting a file (when
2521 extracting an archive).
2522 @end table
2523
2524 @node Backups and Restoration, Media, User Interaction, Top
2525 @chapter Performing Backups and Restoring Files
2526
2527 To @dfn{back up} a file system means to create archives that contain
2528 all the files in that file system. Those archives can then be used to
2529 restore any or all of those files (for instance if a disk crashes or a
2530 file is accidently deleted). File system @dfn{backups} are also
2531 called @dfn{dumps}.
2532
2533 @menu
2534 * Backup Levels:: Levels of backups
2535 * Backup Scripts:: Using scripts to perform backups
2536 and restoration
2537 * incremental and listed-incremental:: The --incremental
2538 and --listed-incremental Options
2539 * Problems:: Some common problems and their solutions
2540 @end menu
2541
2542 @node Backup Levels, Backup Scripts, Backups and Restoration, Backups and Restoration
2543 @section Levels of Backups
2544
2545 An archive containing all the files in the file system is called a
2546 @dfn{full backup} or @dfn{full dump}. You could insure your data by
2547 creating a full dump every day. This strategy, however, would waste a
2548 substantial amount of archive media and user time, as unchanged files
2549 are daily re-archived.
2550
2551 It is more efficient to do a full dump only occasionally. To back up
2552 files between full dumps, you can a incremental dump. A @dfn{level
2553 one} dump archives all the files that have changed since the last full
2554 dump.
2555
2556 A typical dump strategy would be to perform a full dump once a week,
2557 and a level one dump once a day. This means some versions of files
2558 will in fact be archived more than once, but this dump strategy makes
2559 it possible to restore a file system to within one day of accuracy by
2560 only extracting two archives---the last weekly (full) dump and the
2561 last daily (level one) dump. The only information lost would be in
2562 files changed or created since the last daily backup. (Doing dumps
2563 more than once a day is usually not worth the trouble).
2564
2565 @node Backup Scripts, incremental and listed-incremental, Backup Levels, Backups and Restoration
2566 @section Using Scripts to Perform Backups and Restoration
2567
2568 GNU @code{tar} comes with scripts you can use to do full and level-one
2569 dumps. Using scripts (shell programs) to perform backups and
2570 restoration is a convenient and reliable alternative to typing out
2571 file name lists and @code{tar} commands by hand.
2572
2573 Before you use these scripts, you need to edit the file
2574 @file{backup-specs}, which specifies parameters used by the backup
2575 scripts and by the restore script. @xref{Script Syntax}.
2576 Once the backup parameters are set, you can perform backups or
2577 restoration by running the appropriate script.
2578
2579 The name of the restore script is @code{restore}. The names of the
2580 level one and full backup scripts are, respectively, @code{level-1} and
2581 @code{level-0}. The @code{level-0} script also exists under the name
2582 @code{weekly}, and the @code{level-1} under the name
2583 @code{daily}---these additional names can be changed according to your
2584 backup schedule. @xref{Scripted Restoration}, for more information
2585 on running the restoration script. @xref{Scripted Backups}, for more
2586 information on running the backup scripts.
2587
2588 @emph{Please Note:} The backup scripts and the restoration scripts are
2589 designed to be used together. While it is possible to restore files
2590 by hand from an archive which was created using a backup script, and
2591 to create an archive by hand which could then be extracted using the
2592 restore script, it is easier to use the scripts. @xref{incremental
2593 and listed-incremental}, before making such an attempt.
2594
2595 @c shorten node names
2596 @menu
2597 * Backup Parameters:: Setting parameters for backups and restoration
2598 * Scripted Backups:: Using the backup scripts
2599 * Scripted Restoration:: Using the restore script
2600 @end menu
2601
2602 @node Backup Parameters, Scripted Backups, Backup Scripts, Backup Scripts
2603 @subsection Setting Parameters for Backups and Restoration
2604
2605 The file @file{backup-specs} specifies backup parameters for the
2606 backup and restoration scripts provided with @code{tar}. You must
2607 edit @file{backup-specs} to fit your system configuration and schedule
2608 before using these scripts.
2609
2610 @c <<< This about backup scripts needs to be written:
2611 @c <<<BS is a shell script .... thus ... @file{backup-specs} is in shell
2612 @c script syntax. @xref{Script Syntax}, for an explanation of this
2613 @c syntax.
2614
2615 @c whats a parameter .... looked at by the backup scripts ... which will
2616 @c be expecting to find ... now syntax ... value is linked to lame ...
2617 @c @file{backup-specs} specifies the following parameters:
2618
2619
2620 @table @code
2621 @item ADMINISTRATOR
2622 The user name of the backup administrator.
2623
2624 @item BACKUP_HOUR
2625 The hour at which the backups are done. This can be a number from 0
2626 to 23, or the string @samp{now}.
2627
2628 @item TAPE_FILE
2629 The device @code{tar} writes the archive to. This device should be
2630 attached to the host on which the dump scripts are run.
2631 @c <<< examples for all ...
2632
2633 @item TAPE_STATUS
2634 The command to use to obtain the status of the archive device,
2635 including error count. On some tape drives there may not be such a
2636 command; in that case, simply use `TAPE_STATUS=false'.
2637
2638 @item BLOCKING
2639 The blocking factor @code{tar} will use when writing the dump archive.
2640 @xref{Blocking Factor}.
2641
2642 @item BACKUP_DIRS
2643 A list of file systems to be dumped. You can include any directory
2644 name in the list---subdirectories on that file system will be
2645 included, regardless of how they may look to other networked machines.
2646 Subdirectories on other file systems will be ignored.
2647
2648 The host name specifies which host to run @code{tar} on, and should
2649 normally be the host that actually contains the file system. However,
2650 the host machine must have GNU @code{tar} installed, and must be able
2651 to access the directory containing the backup scripts and their
2652 support files using the same file name that is used on the machine
2653 where the scripts are run (ie. what @code{pwd} will print when in that
2654 directory on that machine). If the host that contains the file system
2655 does not have this capability, you can specify another host as long as
2656 it can access the file system through NFS.
2657
2658 @item BACKUP_FILES
2659 A list of individual files to be dumped. These should be accessible
2660 from the machine on which the backup script is run.
2661 @c <<<same file name, be specific. through nfs ...
2662 @end table
2663
2664 @menu
2665 * backup-specs example:: An Example Text of @file{Backup-specs}
2666 * Script Syntax:: Syntax for @file{Backup-specs}
2667 @end menu
2668
2669 @node backup-specs example, Script Syntax, Backup Parameters, Backup Parameters
2670 @subsubsection An Example Text of @file{Backup-specs}
2671
2672 The following is the text of @file{backup-specs} as it appears at FSF:
2673
2674 @example
2675 # site-specific parameters for file system backup.
2676
2677 ADMINISTRATOR=friedman
2678 BACKUP_HOUR=1
2679 TAPE_FILE=/dev/nrsmt0
2680 TAPE_STATUS="mts -t $TAPE_FILE"
2681 BLOCKING=124
2682 BACKUP_DIRS="
2683 albert:/fs/fsf
2684 apple-gunkies:/gd
2685 albert:/fs/gd2
2686 albert:/fs/gp
2687 geech:/usr/jla
2688 churchy:/usr/roland
2689 albert:/
2690 albert:/usr
2691 apple-gunkies:/
2692 apple-gunkies:/usr
2693 gnu:/hack
2694 gnu:/u
2695 apple-gunkies:/com/mailer/gnu
2696 apple-gunkies:/com/archive/gnu"
2697
2698 BACKUP_FILES="/com/mailer/aliases /com/mailer/league*[a-z]"
2699
2700 @end example
2701
2702 @node Script Syntax, , backup-specs example, Backup Parameters
2703 @subsubsection Syntax for @file{Backup-specs}
2704
2705 @file{backup-specs} is in shell script syntax. The following
2706 conventions should be considered when editing the script:
2707 @c <<< "conventions?"
2708
2709 A quoted string is considered to be contiguous, even if it is on more
2710 than one line. Therefore, you cannot include commented-out lines
2711 within a multi-line quoted string. BACKUP_FILES and BACKUP_DIRS are
2712 the two most likely parameters to be multi-line.
2713
2714 A quoted string typically cannot contain wildcards. In
2715 @file{backup-specs}, however, the parameters BACKUP_DIRS and
2716 BACKUP_FILES can contain wildcards.
2717
2718 @node Scripted Backups, Scripted Restoration, Backup Parameters, Backup Scripts
2719 @subsection Using the Backup Scripts
2720
2721 The syntax for running a backup script is:
2722
2723 @example
2724 @file{script-name} [@var{time-to-be-run}]
2725 @end example
2726
2727 where @var{time-to-be-run} can be a specific system time, or can be
2728 @kbd{now}. If you do not specify a time, the script runs at the time
2729 specified in @file{backup-specs} (@pxref{Script Syntax}).
2730
2731 You should start a script with a tape or disk mounted. Once you start
2732 a script, it prompts you for new tapes or disks as it needs them.
2733 Media volumes don't have to correspond to archive files---a
2734 multi-volume archive can be started in the middle of a tape that
2735 already contains the end of another multi-volume archive. The
2736 @code{restore} script prompts for media by its archive volume, so to
2737 avoid an error message you should keep track of which tape (or disk)
2738 contains which volume of the archive. @xref{Scripted Restoration}.
2739
2740 @c <<<have file names changed? -ringo
2741 The backup scripts write two files on the file system. The first is a
2742 record file in @file{/etc/tar-backup/}, which is used by the scripts
2743 to store and retrieve information about which files were dumped. This
2744 file is not meant to be read by humans, and should not be deleted by
2745 them. @xref{incremental and listed-incremental}, for a more
2746 detailed explanation of this file.
2747
2748 The second file is a log file containing the names of the file systems
2749 and files dumped, what time the backup was made, and any error
2750 messages that were generated, as well as how much space was left in
2751 the media volume after the last volume of the archive was written.
2752 You should check this log file after every backup. The file name is
2753 @file{log-@var{mmm-ddd-yyyy}-level-1} or
2754 @file{log-@var{mmm-ddd-yyyy}-full}.
2755
2756 The script also prints the name of each system being dumped to the
2757 standard output.
2758 @c <<<the section on restore scripts is commented out.
2759 @c <<< a section on non-scripted testore mya be a good idea
2760 @ignore
2761 @node Scripted Restoration, , Scripted Backups, Backup Scripts
2762 @subsection Using the Restore Script
2763 @c subject to change as things develop
2764
2765 To restore files that were archived using a scripted backup, use the
2766 @code{restore} script. The syntax for the script is:
2767
2768
2769 where ##### are the file systems to restore from, and
2770 ##### is a regular expression which specifies which files to
2771 restore. If you specify --all, the script restores all the files
2772 in the file system.
2773
2774 You should start the restore script with the media containing the
2775 first volume of the archive mounted. The script will prompt for other
2776 volumes as they are needed. If the archive is on tape, you don't need
2777 to rewind the tape to to its beginning---if the tape head is
2778 positioned past the beginning of the archive, the script will rewind
2779 the tape as needed. @xref{Media}, for a discussion of tape
2780 positioning.
2781
2782 If you specify @samp{--all} as the @var{files} argument, the
2783 @code{restore} script extracts all the files in the archived file
2784 system into the active file system.
2785
2786 @quotation
2787 @strong{Warning:}The script will delete files from the active file
2788 system if they were not in the file system when the archive was made.
2789 @end quotation
2790
2791 @xref{incremental and listed-incremental}, for an explanation of how
2792 the script makes that determination.
2793 @c this may be an option, not a given
2794 @end ignore
2795
2796 @node incremental and listed-incremental, Problems, Backup Scripts, Backups and Restoration
2797 @section The @code{--incremental} and @code{--listed-incremental} Options
2798
2799 @samp{--incremental} is used in conjunction with @samp{--create},
2800 @samp{--extract} or @samp{--list} when backing up and restoring file
2801 systems. An archive cannot be extracted or listed with the
2802 @samp{--incremental} option specified unless it was created with the
2803 option specified. This option should only be used by a script, not by
2804 the user, and is usually disregarded in favor of
2805 @samp{--listed-incremental}, which is described below.
2806
2807 @samp{--incremental} in conjunction with @samp{--create} causes
2808 @code{tar} to write, at the beginning of the archive, an entry for
2809 each of the directories that will be archived. The entry for a
2810 directory includes a list of all the files in the directory at the
2811 time the archive was created and a flag for each file indicating
2812 whether or not the file is going to be put in the archive.
2813
2814 Note that this option causes @code{tar} to create a non-standard
2815 archive that may not be readable by non-GNU versions of the @code{tar}
2816 program.
2817
2818 @samp{--incremental} in conjunction with @samp{--extract} causes
2819 @code{tar} to read the lists of directory contents previously stored
2820 in the archive, @emph{delete} files in the file system that did not
2821 exist in their directories when the archive was created, and then
2822 extract the files in the archive.
2823
2824 This behavior is convenient when restoring a damaged file system from
2825 a succession of incremental backups: it restores the entire state of
2826 the file system to that which obtained when the backup was made. If
2827 @samp{--incremental} isn't specified, the file system will probably
2828 fill up with files that shouldn't exist any more.
2829
2830 @samp{--incremental} in conjunction with @samp{--list}, causes
2831 @code{tar} to print, for each directory in the archive, the list of
2832 files in that directory at the time the archive was created. This
2833 information is put out in a format that is not easy for humans to
2834 read, but which is unambiguous for a program: each file name is
2835 preceded by either a @samp{Y} if the file is present in the archive,
2836 an @samp{N} if the file is not included in the archive, or a @samp{D}
2837 if the file is a directory (and is included in the archive). Each
2838 file name is terminated by a null character. The last file is followed
2839 by an additional null and a newline to indicate the end of the data.
2840
2841 @samp{--listed-incremental}=@var{file} acts like @samp{--incremental},
2842 but when used in conjunction with @samp{--create} will also cause
2843 @code{tar} to use the file @var{file}, which contains information
2844 about the state of the file system at the time of the last backup, to
2845 decide which files to include in the archive being created. That file
2846 will then be updated by @code{tar}. If the file @var{file} does not
2847 exist when this option is specified, @code{tar} will create it, and
2848 include all appropriate files in the archive.
2849
2850 The file @var{file}, which is archive independent, contains the date
2851 it was last modified and a list of devices, inode numbers and
2852 directory names. @code{tar} will archive files with newer mod dates
2853 or inode change times, and directories with an unchanged inode number
2854 and device but a changed directory name. The file is updated after
2855 the files to be archived are determined, but before the new archive is
2856 actually created.
2857
2858 @c <<< this section needs to be written
2859 @node Problems, , incremental and listed-incremental, Backups and Restoration
2860 @section Some Common Problems and their Solutions
2861
2862 errors from system:
2863 permission denied
2864 no such file or directory
2865 not owner
2866
2867 errors from tar:
2868 directory checksum error
2869 header format error
2870
2871 errors from media/system:
2872 i/o error
2873 device busy
2874
2875 @node Media, Quick Reference, Backups and Restoration, Top
2876 @chapter Tapes and Other Archive Media
2877
2878 Archives are usually written on dismountable media---tape cartridges,
2879 mag tapes, or floppy disks.
2880
2881 The amount of data a tape or disk holds depends not only on its size,
2882 but also on how it is formatted. A 2400 foot long reel of mag tape
2883 holds 40 megabytes of data when formated at 1600 bits per inch. The
2884 physically smaller EXABYTE tape cartridge holds 2.3 gigabytes.
2885
2886 Magnetic media are re-usable---once the archive on a tape is no longer
2887 needed, the archive can be erased and the tape or disk used over.
2888 Media quality does deteriorate with use, however. Most tapes or disks
2889 should be disgarded when they begin to produce data errors. EXABYTE
2890 tape cartridges should be disgarded when they generate an @dfn{error
2891 count} (number of non-usable bits) of more than 10k.
2892
2893 Magnetic media are written and erased using magnetic fields, and
2894 should be protected from such fields to avoid damage to stored data.
2895 Sticking a floppy disk to a filing cabinet using a magnet is probably
2896 not a good idea.
2897
2898
2899 @menu
2900 * Write Protection:: Write Protection
2901 * Tape Positioning:: Tape Positions and Tape Marks
2902 @end menu
2903
2904 @node Write Protection, Tape Positioning, Media, Media
2905 @section Write Protection
2906
2907 All tapes and disks can be @dfn{write protected}, to protect data on
2908 them from being changed. Once an archive is written, you should write
2909 protect the media to prevent the archive from being accidently
2910 overwritten or deleted. (This will protect the archive from being
2911 changed with a tape or floppy drive---it will not protect it from
2912 magnet fields or other physical hazards).
2913
2914 The write protection device itself is usually an integral part of the
2915 physical media, and can be a two position (write enabled/write
2916 disabled) switch, a notch which can be popped out or covered, a ring
2917 which can be removed from the center of a tape reel, or some other
2918 changeable feature.
2919
2920 @node Tape Positioning, , Write Protection, Media
2921 @section Tape Positions and Tape Marks
2922
2923 Just as archives can store more than one file from the file system,
2924 tapes can store more than one archive file. To keep track of where
2925 archive files (or any other type of file stored on tape) begin and
2926 end, tape archive devices write magnetic @dfn{tape marks} on the
2927 archive media. Tape drives write one tape mark between files,
2928 two at the end of all the file entries.
2929
2930 If you think of data as a series of "0000"'s, and tape marks as "x"'s,
2931 a tape might look like the following:
2932
2933 @example
2934 0000x000000x00000x00x00000xx-------------------------
2935 @end example
2936
2937 Tape devices read and write tapes using a read/write @dfn{tape
2938 head}---a physical part of the device which can only access one point
2939 on the tape at a time. When you use @code{tar} to read or write
2940 archive data from a tape device, the device will begin reading or
2941 writing from wherever on the tape the tape head happens to be,
2942 regardless of which archive or what part of the archive the tape head
2943 is on. Before writing an archive, you should make sure that no data
2944 on the tape will be overwritten (unless it is no longer needed).
2945 Before reading an archive, you should make sure the tape head is at
2946 the beginning of the archive you want to read. (The @code{restore}
2947 script will find the archive automatically. @xref{Scripted
2948 Restoration}). @xref{mt}, for an explanation of the tape moving
2949 utility.
2950
2951 If you want to add new archive file entries to a tape, you should
2952 advance the tape to the end of the existing file entries, backspace
2953 over the last tape mark, and write the new archive file. If you were
2954 to add two archives to the example above, the tape might look like the
2955 following:
2956
2957 @example
2958 0000x000000x00000x00x00000x000x0000xx----------------
2959 @end example
2960
2961 @menu
2962 * mt:: The @code{mt} Utility
2963 @end menu
2964
2965 @node mt, , Tape Positioning, Tape Positioning
2966 @subsection The @code{mt} Utility
2967
2968 <<< is it true that this only works on non-block devices? should
2969 <<< explain the difference, xref to block-size (fixed or variable).
2970
2971 You can use the @code{mt} utility to advance or rewind a tape past a
2972 specified number of archive files on the tape. This will allow you to
2973 move to the beginning of an archive before extracting or reading it,
2974 or to the end of all the archives before writing a new one.
2975 @c why isn't there an "advance 'til you find two tape marks together"?
2976
2977 The syntax of the @code{mt} command is:
2978
2979 @example
2980 mt [-f @var{tapename}] @var{operation} [@var{number}]
2981 @end example
2982
2983 where @var{tapename} is the name of the tape device, @var{number} is
2984 the number of times an operation is performed (with a default of one),
2985 and @var{operation} is one of the following:
2986
2987 @table @code
2988 @item eof
2989 @itemx weof
2990 Writes @var{number} tape marks at the current position on the tape.
2991
2992
2993 @item fsf
2994 Moves tape position forward @var{number} files.
2995
2996
2997 @item bsf
2998 Moves tape position back @var{number} files.
2999
3000
3001 @item rewind
3002 Rewinds the tape. (Ignores @var{number}).
3003
3004
3005 @item offline
3006 @itemx rewoff1
3007 Rewinds the tape and takes the tape device off-line. (Ignores @var{number}).
3008
3009
3010 @item status
3011 Prints status information about the tape unit.
3012 @end table
3013 <<< is there a better way to frob the spacing on the list? -ringo
3014
3015 If you don't specify a @var{tapename}, @code{mt} uses the environment
3016 variable TAPE; if TAPE does not exist, @code{mt} uses the device
3017 @file{/dev/rmt12}.
3018
3019 @code{mt} returns a 0 exit status when the operation(s) were
3020 successful, 1 if the command was unrecognized, and 2 if an operation
3021 failed.
3022
3023 @c <<< new node on how to find an archive? -ringo
3024 If you use @code{tar --extract} with the
3025 @samp{--label=@var{archive-name}} option specified, @code{tar} will
3026 read an archive label (the tape head has to be positioned on it) and
3027 print an error if the archive label doesn't match the
3028 @var{archive-name} specified. @var{archive-name} can be any regular
3029 expression. If the labels match, @code{tar} extracts the archive.
3030 @xref{Archive Label}. @xref{Matching Format Parameters}.
3031 <<< fix cross references
3032
3033 @code{tar --list --label} will cause @code{tar} to print the label.
3034
3035 @c <<< MIB -- program to list all the labels on a tape?
3036
3037 @node Quick Reference, Data Format Details, Media, Top
3038 @appendix A Quick Reference Guide to @code{tar} Operations and Options
3039 @c put in proper form for appendix. (unnumbered?)
3040
3041 @menu
3042 * Operations:: A Table of Operations
3043 * Options:: Table of Options
3044 @end menu
3045
3046 @node Operations, Options, Quick Reference, Quick Reference
3047 @appendixsec A Table of Operations
3048 @c add xrefs, note synonyms
3049
3050 The operation argument to @code{tar} specifies which action you want to
3051 take.
3052
3053 @table @samp
3054 @item -A
3055 Adds copies of an archive or archives to the end of another archive.
3056
3057 @item -c
3058 Creates a new archive.
3059
3060 @item -d
3061 Compares files in the archive with their counterparts in the file
3062 system, and reports differences in file size, mode, owner,
3063 modification date and contents.
3064
3065 @item -r
3066 Adds files to the end of the archive.
3067
3068 @item -t
3069 Prints a list of the contents of the archive.
3070
3071 @item -x
3072 Reads files from the archive and writes them into the active file
3073 system.
3074
3075 @item -u
3076 Adds files to the end of the archive, but only if they are newer than
3077 their counterparts already in the archive, or if they do not already
3078 exist in the archive.
3079
3080 @item --add-archive
3081 Adds copies of an archive or archives to the end of another archive.
3082
3083 @item --add-file
3084 Adds files to the end of the archive.
3085
3086 @item --append
3087 Adds files to the end of the archive.
3088
3089 @item --catenate
3090 Adds copies of an archive or archives to the end of another archive.
3091
3092 @item --compare
3093 Compares files in the archive with their counterparts in the file
3094 system, and reports differences in file size, mode, owner,
3095 modification date and contents.
3096
3097 @item --concatenate
3098 Adds copies of an archive or archives to the end of another archive.
3099
3100 @item --create
3101 Creates a new archive.
3102
3103 @item --delete
3104 Deletes files from the archive. All versions of the files are deleted.
3105
3106 @item --diff
3107 Compares files in the archive with their counterparts in the file
3108 system, and reports differences in file size, mode, owner,
3109 modification date and contents.
3110
3111 @item --extract
3112 Reads files from the archive and writes them into the active file
3113 system.
3114
3115 @item --get
3116 Reads files from the archive and writes them into the active file
3117 system.
3118
3119 @item --help
3120 Prints a list of @code{tar} operations and options.
3121
3122 @item --list
3123 Prints a list of the contents of the archive.
3124
3125 @item --update
3126 Adds files to the end of the archive, but only if they are newer than
3127 their counterparts already in the archive, or if they do not already
3128 exist in the archive.
3129
3130 @item --version
3131 Prints the version number of the @code{tar} program to the standard
3132 error.
3133 @end table
3134
3135 @node Options, , Operations, Quick Reference
3136 @appendixsec Table of Options
3137
3138 Options change the way @code{tar} performs an operation.
3139
3140 @table @samp
3141 @item --absolute-paths
3142 WILL BE INPUT WHEN QUESTION IS RESOLVED
3143
3144 @item --after-date=@var{date}
3145 Limit the operation to files changed after the given date.
3146 @xref{File Exclusion}.
3147
3148 @item --block-size=@var{number}
3149 Specify the blocking factor of an archive. @xref{Blocking Factor}.
3150
3151 @item --compress
3152 Specify a compressed archive. @xref{Compressed Archives}.
3153
3154 @item --compress-block.
3155 Create a whole block sized compressed archive. @xref{Compressed Archives}.
3156
3157 @item --confirmation
3158 Solicit confirmation for each file. @xref{Interactive Operation}
3159 <<< --selective should be a synonym.
3160
3161 @item --dereference
3162 Treat a symbolic link as an alternate name for the file the link
3163 points to. @xref{Symbolic Links}.
3164
3165 @item --directory=@file{directory}
3166 Change the working directory. @xref{Changing Working Directory}.
3167
3168 @item --exclude=@var{pattern}
3169 Exclude files which match the regular expression @var{pattern}.
3170 @xref{File Exclusion}.
3171
3172 @item --exclude-from=@file{file}
3173 Exclude files which match any of the regular expressions listed in
3174 the file @file{file}. @xref{File Exclusion}.
3175
3176 @item --file=@var{archive-name}
3177 Name the archive. @xref{Archive Name}).
3178
3179 @item --files-from=@file{file}
3180 Read file-name arguments from a file on the file system.
3181 @xref{File Name Lists}.
3182
3183 @item --ignore-umask
3184 Set modes of extracted files to those recorded in the archive.
3185 @xref{File Writing Options}.
3186
3187 @item --ignore-zeros
3188 Ignore end-of-archive entries. @xref{Archive Reading Options}.
3189 <<< this should be changed to --ignore-end
3190
3191 @item --listed-incremental=@var{file-name} (-g)
3192 Take a file name argument always. If the file doesn't exist, run a level
3193 zero dump, creating the file. If the file exists, uses that file to see
3194 what has changed.
3195
3196 @item --incremental (-G)
3197 @c <<<look it up>>>
3198
3199 @item --tape-length=@var{n} (-L)
3200 @c <<<alternate way of doing multi archive, will go to that length and
3201 @c prompts for new tape, automatically turns on multi-volume. >>>
3202 @c <<< this needs to be written into main body as well -ringo
3203
3204 @item --info-script=@var{program-file}
3205 Create a multi-volume archive via a script. @xref{Multi-Volume Archives}.
3206
3207 @item --interactive
3208 Ask for confirmation before performing any operation on a file or
3209 archive member.
3210
3211 @item --keep-old-files
3212 Prevent overwriting during extraction. @xref{File Writing Options}.
3213
3214 @item --label=@var{archive-label}
3215 Include an archive-label in the archive being created. @xref{Archive
3216 Label}.
3217
3218 @item --modification-time
3219 Set the modification time of extracted files to the time they were
3220 extracted. @xref{File Writing Options}.
3221
3222 @item --multi-volume
3223 Specify a multi-volume archive. @xref{Multi-Volume Archives}.
3224
3225 @item --newer=@var{date}
3226 Limit the operation to files changed after the given date.
3227 @xref{File Exclusion}.
3228
3229 @item --newer-mtime=@var{date}
3230 Limit the operation to files modified after the given date. @xref{File
3231 Exclusion}.
3232
3233 @item --old
3234 Create an old format archive. @xref{Old Style File Information}.
3235 @c <<< did we agree this should go away as a synonym?
3236
3237 @item --old-archive
3238 Create an old format archive. @xref{Old Style File Information}.
3239
3240 @item --one-file-system
3241 Prevent @code{tar} from crossing file system boundaries when
3242 archiving. @xref{File Exclusion}.
3243
3244 @item --portable
3245 Create an old format archive. @xref{Old Style File Information}.
3246 @c <<< was portability, may still need to be changed
3247
3248 @item --preserve-order
3249 Help process large lists of file-names on machines with small amounts of
3250 memory. @xref{Archive Reading Options}.
3251
3252 @item --preserve-permission
3253 Set modes of extracted files to those recorded in the archive.
3254 @xref{File Writing Options}.
3255
3256 @item --read-full-blocks
3257 Read an archive with a smaller than specified block size or which
3258 contains incomplete blocks. @xref{Archive Reading Options}).
3259 @c should be --partial-blocks (!!!)
3260
3261 @item --record-number
3262 Print the record number where a message is generated.
3263 @xref{Additional Information}.
3264
3265 @item --same-order
3266 Help process large lists of file-names on machines with small amounts of
3267 memory. @xref{Archive Reading Options}.
3268
3269 @item --same-permission
3270 Set the modes of extracted files to those recorded in the archive.
3271 @xref{File Writing Options}.
3272
3273 @item --sparse
3274 Archive sparse files sparsely. @xref{Sparse Files}.
3275
3276 @item --starting-file=@var{file-name}
3277 Begin reading in the middle of an archive. @xref{Scarce Disk Space}.
3278
3279 @item --to-stdout
3280 Write files to the standard output. @xref{File Writing Options}.
3281
3282 @item --uncompress
3283 Specifdo a compressed archive. @xref{Compressed Archives}.
3284
3285 @item -V @var{archive-label}
3286 Include an archive-label in the archive being created. @xref{Archive
3287 Label}.
3288 @c was --volume
3289
3290 @item --verbose
3291 Print the names of files or archive members as they are being
3292 operated on. @xref{Additional Information}.
3293
3294 @item --verify
3295 Check for discrepancies in the archive immediately after it is
3296 written. @xref{Write Verification}.
3297
3298 @item -B
3299 Read an archive with a smaller than specified block size or which
3300 contains incomplete blocks. @xref{Archive Reading Options}).
3301
3302 @item -K @var{file-name}
3303 Begin reading in the middle of an archive. @xref{Scarce Disk Space}.
3304
3305 @item -M
3306 Specify a multi-volume archive. @xref{Multi-Volume Archives}.
3307
3308 @item -N @var{date}
3309 Limit operation to files changed after the given date. @xref{File Exclusion}.
3310
3311 @item -O
3312 Write files to the standard output. @xref{File Writing Options}.
3313
3314 @c <<<<- P is absolute paths, add when resolved. -ringo>>>
3315
3316 @item -R
3317 Print the record number where a message is generated.
3318 @xref{Additional Information}.
3319
3320 @item -S
3321 Archive sparse files sparsely. @xref{Sparse Files}.
3322
3323 @item -T @var{file}
3324 Read file-name arguments from a file on the file system.
3325 @xref{File Name Lists}.
3326
3327 @item -W
3328 Check for discrepancies in the archive immediately after it is
3329 written. @xref{Write Verification}.
3330
3331 @item -Z
3332 Specify a compressed archive. @xref{Compressed Archives}.
3333
3334 @item -b @var{number}
3335 Specify the blocking factor of an archive. @xref{Blocking Factor}.
3336
3337 @item -f @var{archive-name}
3338 Name the archive. @xref{Archive Name}).
3339
3340 @item -h
3341 Treat a symbolic link as an alternate name for the file the link
3342 points to. @xref{Symbolic Links}.
3343
3344 @item -i
3345 Ignore end-of-archive entries. @xref{Archive Reading Options}.
3346
3347 @item -k
3348 Prevent overwriting during extraction. @xref{File Writing Options}.
3349
3350 @item -l
3351 Prevent @code{tar} from crossing file system boundaries when
3352 archiving. @xref{File Exclusion}.
3353
3354 @item -m
3355 Set the modification time of extracted files to the time they were
3356 extracted. @xref{File Writing Options}.
3357
3358 @item -o
3359 Create an old format archive. @xref{Old Style File Information}.
3360
3361 @item -p
3362 Set the modes of extracted files to those recorded in the archive.
3363 @xref{File Writing Options}.
3364
3365 @item -s
3366 Help process large lists of file-names on machines with small amounts of
3367 memory. @xref{Archive Reading Options}.
3368
3369 @item -v
3370 Print the names of files or archive members they are being operated
3371 on. @xref{Additional Information}.
3372
3373 @item -w
3374 @c <<<see --interactive. WILL BE INPUT WHEN QUESTIONS ARE RESOLVED.>>>
3375
3376 @item -z
3377 Specify a compressed archive. @xref{Compressed Archives}.
3378
3379 @item -z -z
3380 Create a whole block sized compressed archive. @xref{Compressed Archives}.
3381 @c I would rather this were -Z. it is the only double letter short
3382 @c form.
3383
3384 @item -C @file{directory}
3385 Change the working directory. @xref{Changing Working Directory}.
3386
3387 @item -F @var{program-file}
3388 Create a multi-volume archive via a script. @xref{Multi-Volume Archives}.
3389
3390 @item -X @file{file}
3391 Exclude files which match any of the regular expressions listed in
3392 the file @file{file}. @xref{File Exclusion}.
3393 @end table
3394
3395 @node Data Format Details, Concept Index, Quick Reference, Top
3396 @appendix Details of the Archive Data Format
3397
3398 This chapter is based heavily on John Gilmore's @i{tar}(5) manual page
3399 for the public domain @code{tar} that GNU @code{tar} is based on.
3400 @c it's been majorly edited since, we may be able to lose this.
3401
3402 The archive media contains a series of records, each of which contains
3403 512 bytes. Each archive member is represented by a header record,
3404 which describes the file, followed by zero or more records which
3405 represent the contents of the file. At the end of the archive file
3406 there may be a record consisting of a series of binary zeros, as an
3407 end-of-archive marker. GNU @code{tar} writes a record of zeros at the
3408 end of an archive, but does not assume that such a record exists when
3409 reading an archive.
3410
3411 Records may be grouped into @dfn{blocks} for I/O operations. A block
3412 of records is written with a single @code{write()} operation. The
3413 number of records in a block is specified using the @samp{--block-size}
3414 option. @xref{Blocking Factor}, for more information about specifying
3415 block size.
3416
3417 @menu
3418 * Header Data:: The Distribution of Data in the Header
3419 * Header Fields:: The Meaning of Header Fields
3420 * Sparse File Handling:: Fields to Handle Sparse Files
3421 @end menu
3422
3423 @node Header Data, Header Fields, Data Format Details, Data Format Details
3424 @appendixsec The Distribution of Data in the Header
3425
3426 The header record is defined in C as follows:
3427 @c I am taking the following code on faith.
3428
3429 @example
3430 @r{Standard Archive Format - Standard TAR - USTAR}
3431
3432 #define RECORDSIZE 512
3433 #define NAMSIZ 100
3434 #define TUNMLEN 32
3435 #define TGNMLEN 32
3436 #define SPARSE_EXT_HDR 21
3437 #define SPARSE_IN_HDR 4
3438
3439 struct sparse @{
3440 char offset[12];
3441 char numbytes[12];
3442 @};
3443
3444 union record @{
3445 char charptr[RECORDSIZE];
3446 struct header @{
3447 char name[NAMSIZ];
3448 char mode[8];
3449 char uid[8];
3450 char gid[8];
3451 char size[12];
3452 char mtime[12];
3453 char chksum[8];
3454 char linkflag;
3455 char linkname[NAMSIZ];
3456 char magic[8];
3457 char uname[TUNMLEN];
3458 char gname[TGNMLEN];
3459 char devmajor[8];
3460 char devminor[8];
3461
3462 @r{The following fields were added by gnu and are not used by other}
3463 @r{versions of @code{tar}}.
3464 char atime[12];
3465 char ctime[12];
3466 char offset[12];
3467 char longnames[4];
3468 @r{The next three fields were added by gnu to deal with shrinking down}
3469 @r{sparse files.}
3470 struct sparse sp[SPARSE_IN_HDR];
3471 char isextended;
3472 @r{This is the number of nulls at the end of the file, if any.}
3473 char ending_blanks[12];
3474
3475 @} header;
3476
3477 struct extended_header @{
3478 struct sparse sp[21];
3479 char isextended;
3480 @} ext_hdr;
3481
3482 @};
3483 @c <<< this whole thing needs to be put into better english
3484
3485 @r{The checksum field is filled with this while the checksum is computed.}
3486 #define CHKBLANKS " " @r{8 blanks, no null}
3487
3488 @r{Inclusion of this field marks an archive as being in standard}
3489 @r{Posix format (though GNU tar itself is not Posix conforming). GNU}
3490 @r{tar puts "ustar" in this field if uname and gname are valid.}
3491 #define TMAGIC "ustar " @r{7 chars and a null}
3492
3493 @r{The magic field is filled with this if this is a GNU format dump entry.}
3494 #define GNUMAGIC "GNUtar " @r{7 chars and a null}
3495
3496 @r{The linkflag defines the type of file.}
3497 #define LF_OLDNORMAL '\0' @r{Normal disk file, Unix compatible}
3498 #define LF_NORMAL '0' @r{Normal disk file}
3499 #define LF_LINK '1' @r{Link to previously dumped file}
3500 #define LF_SYMLINK '2' @r{Symbolic link}
3501 #define LF_CHR '3' @r{Character special file}
3502 #define LF_BLK '4' @r{Block special file}
3503 #define LF_DIR '5' @r{Directory}
3504 #define LF_FIFO '6' @r{FIFO special file}
3505 #define LF_CONTIG '7' @r{Contiguous file}
3506
3507 @r{hhe following are further link types which were defined later.}
3508
3509 @r{This is a dir entry that contains the names of files that were in}
3510 @r{the dir at the time the dump was made.}
3511 #define LF_DUMPDIR 'D'
3512
3513 @r{This is the continuation of a file that began on another volume}
3514 #define LF_MULTIVOL 'M'
3515
3516 @r{This is for sparse files}
3517 #define LF_SPARSE 'S'
3518
3519 @r{This file is a tape/volume header. Ignore it on extraction.}
3520 #define LF_VOLHDR 'V'
3521
3522 @r{These are bits used in the mode field - the values are in octal}
3523 #define TSUID 04000 @r{Set UID on execution}
3524 #define TSGID 02000 @r{Set GID on execution}
3525 #define TSVTX 01000 @r{Save text (sticky bit)}
3526
3527 @r{These are file permissions}
3528 #define TUREAD 00400 @r{read by owner}
3529 #define TUWRITE 00200 @r{write by owner}
3530 #define TUEXEC 00100 @r{execute/search by owner}
3531 #define TGREAD 00040 @r{read by group}
3532 #define TGWRITE 00020 @r{write by group}
3533 #define TGEXEC 00010 @r{execute/search by group}
3534 #define TOREAD 00004 @r{read by other}
3535 #define TOWRITE 00002 @r{write by other}
3536 #define TOEXEC 00001 @r{execute/search by other}
3537 @end example
3538
3539
3540 All characters in headers are 8-bit characters in the local variant of
3541 ASCII. Each field in the header is contiguous; that is, there is no
3542 padding in the header format.
3543
3544 Data representing the contents of files is not translated in any way
3545 and is not constrained to represent characters in any character set.
3546 @code{tar} does not distinguish between text files and binary files.
3547
3548 The @code{name}, @code{linkname}, @code{magic}, @code{uname}, and
3549 @code{gname} fields contain null-terminated character strings. All
3550 other fields contain zero-filled octal numbers in ASCII. Each numeric
3551 field of width @var{w} contains @var{w} @minus{} 2 digits, a space, and a
3552 null, except @code{size} and @code{mtime}, which do not contain the
3553 trailing null.
3554
3555 @node Header Fields, Sparse File Handling, Header Data, Data Format Details
3556 @appendixsec The Meaning of Header Fields
3557
3558 The @code{name} field contains the name of the file.
3559 <<< how big a name before field overflows?
3560
3561 The @code{mode} field contains nine bits which specify file
3562 permissions, and three bits which specify the Set UID, Set GID, and
3563 Save Text (``stick'') modes. Values for these bits are defined above.
3564 @xref{File Writing Options}, for information on how file permissions
3565 and modes are used by @code{tar}.
3566
3567 The @code{uid} and @code{gid} fields contain the numeric user and
3568 group IDs of the file owners. If the operating system does not
3569 support numeric user or group IDs, these fields should be ignored.
3570 @c but are they?
3571
3572 The @code{size} field contains the size of the file in bytes; this
3573 field contains a zero if the header describes a link to a file.
3574
3575 The @code{mtime} field contains the modification time of the file.
3576 This is the ASCII representation of the octal value of the last time
3577 the file was modified, represented as an integer number of seconds
3578 since January 1, 1970, 00:00 Coordinated Universal Time.
3579 @xref{File Writing Options}, for a description of how @code{tar} uses
3580 this information.
3581
3582 The @code{chksum} field contains the ASCII representation of the octal
3583 value of the simple sum of all bytes in the header record. To
3584 generate this sum, each 8-bit byte in the header is added to an
3585 unsigned integer, which has been initialized to zero. The precision
3586 of the integer is seventeen bits. When calculating the checksum, the
3587 @code{chksum} field itself is treated as blank.
3588
3589 The @code{atime} and @code{ctime} fields are used when making
3590 incremental backups; they store, respectively, the file's access time
3591 and last inode-change time.
3592
3593 The value in the @code{offset} field is used when making a
3594 multi-volume archive. The offset is number of bytes into the file
3595 that we need to go to pick up where we left off in the previous
3596 volume, i.e the location that a continued file is continued from.
3597
3598 The @code{longnames} field supports a feature that is not yet
3599 implemented. This field should be empty.
3600
3601 The @code{magic} field indicates that this archive was output in the
3602 P1003 archive format. If this field contains @code{TMAGIC}, the
3603 @code{uname} and @code{gname} fields will contain the ASCII
3604 representation of the owner and group of the file respectively. If
3605 found, the user and group IDs are used rather than the values in the
3606 @code{uid} and @code{gid} fields.
3607
3608 The @code{sp} field is used to archive sparse files efficiently.
3609 @xref{Sparse File Handling}, for a description of this field, and
3610 other fields it may imply.
3611
3612 The @code{typeflag} field specifies the file's type. If a particular
3613 implementation does not recognize or permit the specified type,
3614 @code{tar} extracts the file as if it were a regular file, and reports
3615 the discrepancy on the standard error. @xref{File Types}. @xref{GNU
3616 File Types}.
3617
3618 @menu
3619 * File Types:: File Types
3620 * GNU File Types:: Additional File Types Supported by GNU
3621 @end menu
3622
3623 @node File Types, GNU File Types, Header Fields, Header Fields
3624 @appendixsubsec File Types
3625
3626 The following flags are used to describe file types:
3627
3628 @table @code
3629 @item LF_NORMAL
3630 @itemx LF_OLDNORMAL
3631 Indicates a regular file. In order to be compatible with older
3632 versions of @code{tar}, a @code{typeflag} value of @code{LF_OLDNORMAL}
3633 should be silently recognized as a regular file. New archives should
3634 be created using @code{LF_NORMAL} for regular files. For backward
3635 compatibility, @code{tar} treats a regular file whose name ends with a
3636 slash as a directory.
3637
3638 @item LF_LINK
3639 Indicates a link to another file, of any type, which has been
3640 previously archived. @code{tar} identifies linked files in Unix by
3641 matching device and inode numbers. The linked-to name is specified in
3642 the @code{linkname} field with a trailing null.
3643
3644 @item LF_SYMLINK
3645 Indicates a symbolic link to another file. The linked-to
3646 name is specified in the @code{linkname} field with a trailing null.
3647 @xref{File Writing Options}, for information on archiving files
3648 referenced by a symbolic link.
3649
3650 @item LF_CHR
3651 @itemx LF_BLK
3652 Indicate character special files and block special files,
3653 respectively. In this case the @code{devmajor} and @code{devminor}
3654 fields will contain the major and minor device numbers. Operating
3655 systems may map the device specifications to their own local
3656 specification, or may ignore the entry.
3657
3658 @item LF_DIR
3659 Indicates a directory or sub-directory. The directory name in the
3660 @code{name} field should end with a slash. On systems where disk
3661 allocation is performed on a directory basis, the @code{size} field
3662 will contain the maximum number of bytes (which may be rounded to the
3663 nearest disk block allocation unit) that the directory can hold. A
3664 @code{size} field of zero indicates no size limitations. Systems that
3665 do not support size limiting in this manner should ignore the
3666 @code{size} field.
3667
3668 @item LF_FIFO
3669 Indicates a FIFO special file. Note that archiving a FIFO file
3670 archives the existence of the file and not its contents.
3671
3672 @item LF_CONTIG
3673 Indicates a contiguous file. Contiguous files are the same as normal
3674 files except that, in operating systems that support it, all the
3675 files' disk space is allocated contiguously. Operating systems which
3676 do not allow contiguous allocation should silently treat this type as
3677 a normal file.
3678
3679 @item 'A' @dots{}
3680 @itemx 'Z'
3681 These are reserved for custom implementations. Some of these are used
3682 in the GNU modified format, which is described below. @xref{GNU File
3683 Types}.
3684 @end table
3685
3686 Certain other flag values are reserved for specification in future
3687 revisions of the P1003 standard, and should not be used by any
3688 @code{tar} program.
3689
3690 @node GNU File Types, , File Types, Header Fields
3691 @appendixsubsec Additional File Types Supported by GNU
3692
3693 GNU @code{tar} uses additional file types to describe new types of
3694 files in an archive. These are listed below.
3695
3696 @table @code
3697 @item LF_DUMPDIR
3698 @itemx 'D'
3699 Indicates a directory and a list of files created by the
3700 @samp{--incremental} option. The @code{size} field gives the total
3701 size of the associated list of files. Each file name is preceded by
3702 either a @code{'Y'} (the file should be in this archive) or an
3703 @code{'N'} (the file is a directory, or is not stored in the archive).
3704 Each file name is terminated by a null. There is an additional null
3705 after the last file name.
3706
3707 @item LF_MULTIVOL
3708 @itemx 'M'
3709 Indicates a file continued from another volume of a multi-volume
3710 archive (@pxref{Multi-Volume Archives}). The original type of the file is not
3711 given here. The @code{size} field gives the maximum size of this
3712 piece of the file (assuming the volume does not end before the file is
3713 written out). The @code{offset} field gives the offset from the
3714 beginning of the file where this part of the file begins. Thus
3715 @code{size} plus @code{offset} should equal the original size of the
3716 file.
3717
3718 @item LF_SPARSE
3719 @itemx 'S'
3720 Indicates a sparse file. @xref{Sparse Files}. @xref{Sparse File
3721 Handling}.
3722
3723 @item LF_VOLHDR
3724 @itemx 'V'
3725 Marks an archive label that was created using the @samp{--label} option
3726 when the archive was created (@pxref{Archive Label}. The @code{name}
3727 field contains the argument to the option. The @code{size} field is
3728 zero. Only the first file in each volume of an archive should have
3729 this type.
3730 @end table
3731
3732 @node Sparse File Handling, , Header Fields, Data Format Details
3733 @appendixsec Fields to Handle Sparse Files
3734
3735 The following header information was added to deal with sparse files
3736 (@pxref{Sparse Files}):
3737
3738 @c TALK TO MIB
3739 The @code{sp} field (fields? something else?) is an array of
3740 @code{struct sparse}. Each @code{struct sparse} contains two
3741 12-character strings, which represent the offset into the file and the
3742 number of bytes to be written at that offset. The offset is absolute,
3743 and not relative to the offset in preceding array elements.
3744
3745 The header can contain four of these @code{struct sparse}; if more are
3746 needed, they are not stored in the header, instead, the flag
3747 @code{isextended} is set and the next record is an
3748 @code{extended_header}.
3749 @c @code{extended_header} or @dfn{extended_header} ??? the next
3750 @c record after the header, or in the middle of it.
3751
3752 The @code{isextended} flag is only set for sparse files, and then only
3753 if extended header records are needed when archiving the file.
3754
3755 Each extended header record can contain an array of 21 sparse
3756 structures, as well as another @code{isextended} flag. There is no
3757 limit (except that implied by the archive media) on the number of
3758 extended header records that can be used to describe a sparse file.
3759
3760 @c so is @code{extended_header} the right way to write this?
3761
3762 @node Concept Index, , Data Format Details, Top
3763 @unnumbered Concept Index
3764
3765 @printindex cp
3766
3767 @summarycontents
3768 @contents
3769 @bye
3770
3771
This page took 0.18707 seconds and 5 git commands to generate.