~ubuntu-branches/ubuntu/hardy/afio/hardy

« back to all changes in this revision

Viewing changes to afio.1

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2002-03-14 10:30:49 UTC
  • Revision ID: james.westby@ubuntu.com-20020314103049-nifwa0xp6x1g63bu
Tags: upstream-2.4.7
ImportĀ upstreamĀ versionĀ 2.4.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'br $Header: /u/buhrt/src/afio/RCS/afio.1,v 2.3 1991/09/25 20:08:33 buhrt Exp $
 
2
.TH AFIO 1
 
3
.SH NAME
 
4
afio \- manipulate archives and files
 
5
.SH SYNOPSIS
 
6
.B ...
 
7
 
8
.B afio -o
 
9
[
 
10
.I options
 
11
] archive  : write archive
 
12
.br
 
13
.B afio -i 
 
14
[
 
15
.I options
 
16
] archive  : install archive
 
17
.br
 
18
.B afio -t 
 
19
[
 
20
.I options
 
21
] archive  : list table-of-contents of archive
 
22
.br
 
23
.B afio -r
 
24
[
 
25
.I options
 
26
] archive  : verify archive against filesystem
 
27
.br
 
28
.B afio -p
 
29
[
 
30
.I options
 
31
] directory [ ... ] : copy files
 
32
.PP
 
33
.SH DESCRIPTION
 
34
.I Afio
 
35
manipulates groups of files, copying them within the (collective)
 
36
filesystem or between the filesystem and an
 
37
.I afio
 
38
archive. Note that
 
39
.I afio
 
40
archives are portable, as they contain only ASCII-formatted
 
41
header information. They are also compatible with ASCII
 
42
.IR cpio (1)
 
43
archives (ala
 
44
.IR "cpio \-c" ,
 
45
for GNU 
 
46
.IR cpio (1)
 
47
also
 
48
.IR "cpio -H odc" ).  
 
49
However, archives made with using
 
50
.BR \-4
 
51
option are
 
52
.BR not
 
53
portable.
 
54
.PP
 
55
With
 
56
.BR \-o ,
 
57
reads pathnames from the standard input
 
58
and writes an
 
59
.IR archive .
 
60
.PP
 
61
With
 
62
.BR \-t ,
 
63
reads an
 
64
.I archive
 
65
and writes a table-of-contents to the standard output.
 
66
.PP
 
67
With
 
68
.BR \-i ,
 
69
installs the contents of an
 
70
.I archive
 
71
relative to the working directory.
 
72
.PP
 
73
With
 
74
.BR \-p ,
 
75
reads pathnames from the standard input
 
76
and copies the files to each
 
77
.IR directory .
 
78
Cannot be combined with the
 
79
.B \-Z
 
80
option.
 
81
.PP
 
82
With
 
83
.BR \-r ,
 
84
reads
 
85
.IR archive
 
86
and verifies it against the filesystem.  This is useful for verifying
 
87
tape archives.
 
88
.PP
 
89
Creates missing directories as necessary, with permissions
 
90
to match their parents.
 
91
.PP
 
92
Removes leading slashes from pathnames when reading, writing, and cataloging
 
93
an archive, unless instructed not to.
 
94
.PP
 
95
Supports multi-volume archives during interactive operation
 
96
(i.e., when
 
97
.I /dev/tty
 
98
is accessible and
 
99
.I SIGINT
 
100
is not being ignored).
 
101
.PP
 
102
.SH OPTIONS
 
103
.TP 13
 
104
.BI "-@ " address
 
105
Send email to
 
106
.I address
 
107
when a volume change (tape change, floppy change) is needed, and also when
 
108
the entire operation is complete.  Uses
 
109
.IR sendmail (1)
 
110
to send the mail.
 
111
.TP
 
112
.B -a
 
113
Preserve the last access times (atimes) of the files read when
 
114
making or verifying an archive.
 
115
.B Warning:
 
116
if this option is used, 
 
117
.I afio
 
118
will change the last inode changed times (ctimes) of these files.
 
119
Thus, this option cannot be used together with an incremental backup
 
120
scheme that relies on the ctimes being preserved.
 
121
.TP
 
122
.BI \-b "\ size"
 
123
Read or write
 
124
.IR size -character
 
125
archive blocks.
 
126
Suffices of
 
127
.BR b ,
 
128
.BR k ,
 
129
.B m
 
130
and
 
131
.B g
 
132
denote multiples of
 
133
.IR 512 ,
 
134
.IR kilobytes ,
 
135
.IR megabytes
 
136
and
 
137
.IR gigabytes ,
 
138
respectively.
 
139
Defaults to
 
140
.I 5120
 
141
for compatibility with
 
142
.IR cpio (1).
 
143
In some cases, notably when using
 
144
.I ftape
 
145
with some tape drives,
 
146
.B \-b 10k
 
147
is needed for compatibility.  Note that 
 
148
.B \-b 10k
 
149
is the default block size used by 
 
150
.IR tar (1),
 
151
so it is usually a good choice if the tape setup is known to work
 
152
with 
 
153
.IR tar (1).
 
154
.TP
 
155
.BI \-c "\ count"
 
156
Buffer
 
157
.I count
 
158
archive blocks between I/O operations. A large
 
159
.I count
 
160
is recommended for efficient use with streaming magnetic tape drives, in
 
161
order to reduce the number of tape stops and restarts.
 
162
.TP
 
163
.B \-d
 
164
Don't create missing directories.
 
165
.TP
 
166
.BI \-e "\ bound"
 
167
Pad the archive to a multiple of
 
168
.I bound
 
169
characters.
 
170
Recognizes the same suffices as
 
171
.BR \-s .
 
172
Defaults to
 
173
.I 1x\^
 
174
(the
 
175
.B \-b
 
176
block size)
 
177
for compatibility with
 
178
.IR cpio (1).
 
179
.TP
 
180
.B \-f
 
181
Spawn a child process to actually write to the archive; provides
 
182
a clumsy form of double-buffering.
 
183
Requires
 
184
.B \-s
 
185
for multi-volume archive support.
 
186
.TP
 
187
.B \-g
 
188
Change to input file directories. Avoids quadratic filesystem
 
189
behavior with long similar pathnames. Requires all absolute
 
190
pathnames, including those for the
 
191
.B \-o
 
192
.I archive
 
193
and the
 
194
.B \-p
 
195
.IR directories .
 
196
.TP
 
197
.B \-h
 
198
Follow symbolic links, treating them as ordinary files and directories.
 
199
.TP
 
200
.B \-j
 
201
Don't generate sparse filesystem blocks on restoring files.
 
202
By default, 
 
203
.I afio 
 
204
creates sparse filesystem blocks (with
 
205
.IR lseek (2))
 
206
when possible when restoring files from an archive, 
 
207
but not if these files were stored in a compressed form.   Unless stored in
 
208
a compressed form, sparse files are not archived efficiently: 
 
209
they will take space equal to the full file length.  
 
210
(The sparse file handling in
 
211
.I afio
 
212
does not make much sense except in a historical way.)
 
213
.TP
 
214
.B \-k
 
215
Skip corrupt data at the
 
216
.I beginning
 
217
of an archive (rather
 
218
than complaining about unrecognizable input).
 
219
.TP
 
220
.B \-l
 
221
With
 
222
.BR \-o ,
 
223
write file contents with each hard link.
 
224
.sp
 
225
With
 
226
.BR \-t ,
 
227
report hard links.
 
228
.sp
 
229
With
 
230
.BR \-p ,
 
231
attempt to link files rather than copying them.
 
232
.TP
 
233
.B \-m
 
234
Mark output files with a common current timestamp
 
235
(rather than with input file modification times).
 
236
.TP
 
237
.B \-n
 
238
Protect newer existing files (comparing file modification times).
 
239
.TP
 
240
.BI \-s "\ size"
 
241
Restrict each portion of a multi-volume archive to
 
242
.I size
 
243
characters. This
 
244
option recognizes the same size suffices as
 
245
.BR \-b .
 
246
Also, the suffix
 
247
.B x
 
248
denotes a multiple of the
 
249
.B \-b
 
250
block size (and must follow any
 
251
.B \-b
 
252
specification).
 
253
.I size
 
254
can be a single size or a  comma-seperated list of sizes,
 
255
for example '2m,5m,8m', to specify different sizes for the
 
256
subsequent volumes.  If there are more volumes than sizes, the last
 
257
specified size is used for all remaining volumes.
 
258
This option is useful
 
259
with finite-length devices which do not return short
 
260
counts at end of media (sigh); output to magnetic tape typically
 
261
falls into this category.   When an archive is being read or written, using
 
262
.B \-s
 
263
causes
 
264
.I afio
 
265
to prompt for the next volume if the specified volume length is reached.
 
266
The 
 
267
.B \-s
 
268
option will also cause
 
269
.I afio
 
270
to prompt if there is a premature EOF while reading the input.
 
271
The special case
 
272
.B -s 0
 
273
will activate this prompting for the next volume on premature EOF without 
 
274
setting a volume length.   
 
275
When writing an archive, 
 
276
.I afio
 
277
will prompt for the next volume on end-of-media, even without
 
278
.B -s 0
 
279
being supplied, if the device is capable of reporting end-of-media.
 
280
If the volume
 
281
.I size 
 
282
specified is not a multiple of the block size set with the
 
283
.B -b
 
284
option, then
 
285
.I afio(1)
 
286
will silently round down the volume size to the nearest multiple of
 
287
the block size.  This rounding down can be suppressed using the 
 
288
.B -9
 
289
option: if
 
290
.B -9
 
291
is used, 
 
292
.I afio(1)
 
293
will write a small block of data, smaller than the 
 
294
.B -b
 
295
size, at the  end of the volume to completely fill it to the  specified 
 
296
size.  Some devices are not able to handle such small block writes.
 
297
.TP
 
298
.B \-u
 
299
Report files with unseen links.
 
300
.TP
 
301
.B \-v
 
302
Verbose. Report pathnames as they are processed. With
 
303
.BR \-t ,
 
304
gives an
 
305
.I "ls \-l"
 
306
style report (including link information).
 
307
.TP
 
308
.BI \-w "\ filename"
 
309
Treats each line in
 
310
.I filename
 
311
as an
 
312
.B \-y
 
313
pattern, see
 
314
.BR \-y .
 
315
.TP
 
316
.B \-x
 
317
Retain file ownership and setuid/setgid permissions.
 
318
This is the default for the super-user; he may use
 
319
.B \-X
 
320
to override it.
 
321
.TP
 
322
.BI \-y "\ pattern"
 
323
Restrict processing of files to names matching shell wildcard pattern
 
324
.IR pattern .
 
325
Use this flag once for each pattern to be recognized.
 
326
With the possible exception of the presence of a leading slash, the
 
327
complete file name as appearing in the archive table-of-contents must
 
328
match the pattern, for example the file name 'etc/passwd' is matched
 
329
by the pattern '*passwd' but NOT by the pattern 'passwd'.  See
 
330
.B `man 7 glob' 
 
331
for more information on shell wildcard pattern matching.
 
332
The only difference with shell wildcard pattern matching is that in 
 
333
.I afio
 
334
the wildcards will also match '/' characters in file
 
335
names.  For example the pattern '/usr/src/*' will match the 
 
336
file name '/usr/src/linux/Makefile', and any other file name
 
337
starting with '/usr/src'. Unless the 
 
338
.B -S
 
339
option is given, any leading slash in the pattern or the filename is
 
340
ignored when matching,
 
341
e.g. 
 
342
.I /etc/passwd 
 
343
will match
 
344
.IR etc/passwd .
 
345
Use
 
346
.B \-Y
 
347
to supply patterns which are
 
348
.I not
 
349
to be processed. 
 
350
.B \-Y
 
351
overrides
 
352
.B \-y
 
353
if a filename matches both. 
 
354
See also 
 
355
.BR \-w\  and\  \-W .
 
356
.B Note:
 
357
if 
 
358
.I afio
 
359
was compiled without using the GNU fnmatch library, then the full
 
360
shell wildcard pattern syntax cannot be used, 
 
361
and matching support is limited to patterns which are a full
 
362
literal file name and patterns which end in '*'.
 
363
.TP
 
364
.B \-z
 
365
Print execution statistics. This is meant for human consumption;
 
366
use by other programs is officially discouraged.
 
367
.TP
 
368
.B -A
 
369
Do not turn absolute paths into relative paths. That is don't remove
 
370
the leading slash.
 
371
.TP
 
372
.B -B
 
373
If the 
 
374
.B -v
 
375
option is used, prints the byte offset of the start of each file in
 
376
the archive.
 
377
If your tape drive can start reading at any position in an
 
378
archive, the output of 
 
379
.B -B
 
380
can be useful for doing quick selective restores.
 
381
.TP
 
382
.BI -D "\ controlscript"
 
383
Set the control script name to
 
384
.IR controlscript ,
 
385
see the section on
 
386
.B control files
 
387
below.
 
388
.TP
 
389
.BI -E "\ filename"
 
390
Read file extensions, separated by whitespace, from
 
391
.IR filename .
 
392
Files with these extensions are not to be compressed when using the
 
393
.B -Z
 
394
option.
 
395
.I filename
 
396
may contain comments preceded by a #.
 
397
If no
 
398
.B -E
 
399
is given, files with the extensions
 
400
.I  .Z .z .gz .bz2 .tgz
 
401
.I  .arc .zip .rar .lzh .lha 
 
402
.I  .uc2 .tpz .taz .tgz .rpm .zoo .deb
 
403
.I  .gif .jpeg .jpg .tif .tiff
 
404
and
 
405
.I .png
 
406
will not be compressed.
 
407
.TP
 
408
.B -F
 
409
This is a floppy disk, 
 
410
.B -s
 
411
is required.  Causes floppy writing in
 
412
.B O_SYNC
 
413
mode under Linux.  With kernel version 1.1.54 and above, this allows
 
414
.I afio
 
415
to detect some floppy errors while writing.
 
416
Uses shared memory if compiled in otherwise mallocs as needed (a 3b1
 
417
will not be able to malloc the needed memory w/o shared memory),
 
418
.I afio
 
419
assumes either way you can malloc/shmalloc a chunck of memory
 
420
the size of one disk. Examples: 795k: 3.5" (720k drive), 316k (360k drive)
 
421
.nf
 
422
At the end of each disk this message occurs:
 
423
 Ready for disk [#] on [output] 
 
424
 (remove the disk when the light goes out)
 
425
 Type "go" (or "GO") when ready to proceed
 
426
 (or "quit" to abort):
 
427
.fi
 
428
.TP
 
429
.BI \-G "\ factor"
 
430
Specifies the 
 
431
.IR gzip (1)
 
432
compression speed factor, used when compressing files with the 
 
433
.B -Z
 
434
option.
 
435
Factor 1 is the fastest with least compression, 9 is slowest with best
 
436
compression.
 
437
The default value is 6.  See also the 
 
438
.IR gzip (1)
 
439
manual page. 
 
440
If you have a slow machine or a fast backup medium, you may want to
 
441
specify a low value for
 
442
.I factor
 
443
to speed up the backup.  On large (>200k) files, 
 
444
.B -G 1
 
445
typically zips twice as fast as 
 
446
.BR "-G 6" ,
 
447
while still achieving a better result than 
 
448
.IR compress "(1)."
 
449
The zip speed for small files is mainly determined by the invocation time
 
450
of 
 
451
.I gzip 
 
452
(1), see the 
 
453
.B -T
 
454
option.
 
455
.TP
 
456
.BI "-H " promptscript
 
457
Specify a script to run, in stead of using the normal prompt, before
 
458
advancing to the next achive volume.  The script will be run with the
 
459
volume number, archive specification, and  the reason for changing to 
 
460
the next volume as arguments.  The script
 
461
should exit with 0 for OK and 1 for abort, other exit codes will be
 
462
treated as fatal errors.
 
463
.TP
 
464
.B -J
 
465
Try to continue after a media write error when doing a backup (normal
 
466
behavior is to abort with a fatal error).
 
467
.TP
 
468
.B -K
 
469
Verify the output against what is in the memory copy of the disk (-F required).
 
470
If the writing or verifying fails the following menu pops up
 
471
.nf
 
472
    [Writing/Verify] of disk [disk #] has FAILED!
 
473
        Enter 1 to RETRY this disk
 
474
        Enter 2 to REFORMAT this disk before a RETRY
 
475
 
 
476
        Enter quit to ABORT this backup
 
477
.fi
 
478
Currently,
 
479
.I afio
 
480
will not process the answers 1 and 2 in the right way.  The menu above
 
481
is only useful in that it signifies that something is wrong.
 
482
.TP
 
483
.BI "-L " Log_file_path
 
484
Specify the name of the file to log errors and the final totals to.
 
485
.TP
 
486
.BI \-M "\ size
 
487
Specifies the maximum amount of memory to use for the temporary storage of
 
488
compression results when using the
 
489
.B -Z
 
490
option. The default is 
 
491
.B -M 2m
 
492
(2 megabytes).  If the compressed version of a file is larger than
 
493
this (or if 
 
494
.I afio 
 
495
runs out of virtual memory), 
 
496
.IR gzip (1)
 
497
is run twice of the file,
 
498
the first time to determine the length of the result, the second time
 
499
to get the compressed data itself.
 
500
.TP
 
501
.BI \-P "\ progname"
 
502
Use the program 
 
503
.I progname
 
504
instead of the standard 
 
505
.I gzip
 
506
for compression and decompression with the
 
507
.B -Z
 
508
option.  See also the
 
509
.BR -Q ,
 
510
.B -U
 
511
and
 
512
.B -3
 
513
options.
 
514
.TP
 
515
.BI \-Q "\ opt"
 
516
Pass the option
 
517
.I "opt"
 
518
to the compression or decompression program used with the
 
519
.B -Z
 
520
option. For passing multiple options, use
 
521
.B -Q 
 
522
multiple times.  If no
 
523
.B -Q
 
524
flag is present, the standard options are passed.  The standard
 
525
options are
 
526
.B -c -6
 
527
when the program is called for compression and 
 
528
.B -c -d
 
529
when the program is called for decompression.  Use the special case
 
530
.B -Q 
 
531
""
 
532
if no options at all are to be passed to the program.
 
533
.TP
 
534
.BI -R "\ Disk format command string"
 
535
This is the command that is run when you enter 2 to reformat the disk after
 
536
a failed verify.
 
537
The default (fdformat /dev/fd0H1440) can be changed
 
538
to a given system's default by editing the Makefile.
 
539
You are also prompted for formatting whenever a disk change
 
540
is requested.
 
541
.TP
 
542
.BI -S
 
543
Do not ignore a leading slash in the pattern or the file name when matching 
 
544
.B \-y
 
545
and
 
546
.B -Y
 
547
patterns. See also 
 
548
.BR -A .
 
549
.TP
 
550
.BI -T "\ threshold"
 
551
Only compress a file when using the
 
552
.B -Z
 
553
option if its length is at least
 
554
.IR threshold .
 
555
The default is 
 
556
.BR "-T 0k" .
 
557
This is useful if you have a slow machine or a fast backup medium.
 
558
Specifying 
 
559
.B "-T 3k"
 
560
typically halves the number of invocations of
 
561
.IR gzip (1),
 
562
saving some 30% computation time, while creating an archive
 
563
that is only 5% longer.  The combination 
 
564
.B -T 8k -G 1
 
565
typically saves 70% computation time and gives a 20% size increase.
 
566
The latter combination may be a good alternative to not using 
 
567
.B -Z
 
568
at all.  These figures of course depend heavily on the kind of files
 
569
in the archive and the processor - i/o speed ratio on your machine.
 
570
.TP
 
571
.B -U
 
572
If used with the 
 
573
.B -Z
 
574
option, forces compressed versions to be stored of all files, even if
 
575
the compressed versions are bigger than the original versions, and 
 
576
disregarding any (default) values of the 
 
577
.B -T 
 
578
and 
 
579
.B -2 
 
580
options.  This is useful when the 
 
581
.B -P
 
582
and
 
583
.B -Q
 
584
options are used to replace the compression program 
 
585
.I gzip
 
586
with an encryption program in order to make an archive with encrypted files.
 
587
Due to internal limitations of 
 
588
.IR afio ,
 
589
use of this flag forces the writing of file content with each hard
 
590
linked file, rather than only once for every set of hard linked files.
 
591
.TP
 
592
.BI \-W "\ filename"
 
593
Treats each line in
 
594
.I filename
 
595
as an
 
596
.B \-Y
 
597
pattern, see
 
598
.BR \-Y .
 
599
.TP
 
600
.BI \-Y "\ pattern"
 
601
Do 
 
602
.I not 
 
603
process files whose names match shell wildcard pattern
 
604
.IR pattern .
 
605
See also 
 
606
.BR "\-y " and " -W" .
 
607
.TP
 
608
.B -Z
 
609
Gzip the files on the way out, in, and passing without links
 
610
(valid w/ or w/o 
 
611
.BR -F "\ or" "\ -K" ),
 
612
requires 
 
613
.IR gzip (1)
 
614
to be
 
615
in your path.  See also the
 
616
.BR -G ,
 
617
.BR -P ,
 
618
.BR -Q ,
 
619
.BR -T ,
 
620
.BR -2 ,
 
621
and
 
622
.B -3
 
623
options.
 
624
.TP
 
625
.B -0
 
626
Assume input filenames to be terminated with a '\\0' instead 
 
627
of a '\\n'. When used with 
 
628
.IR "find ... -print0" , 
 
629
can be used to ensure that any filename can be handled, 
 
630
even if it contains a newline.
 
631
.TP
 
632
.BI \-1 "\ warnings-to-ignore-on-exit"
 
633
Control if
 
634
.IR afio (1)
 
635
should exit with a nonzero code after printing warning messages.
 
636
This option is sometimes useful when calling 
 
637
.IR afio (1)
 
638
from inside a backup script or program. 
 
639
.IR afio (1) 
 
640
will exit with a nonzero code on encountering 
 
641
various 'hard' errors, and also (by default) when it has printed
 
642
certain warning messages during execution.
 
643
.I warnings-to-ignore-on-exit
 
644
is a list of letters which label the warning messages
 
645
that should 
 
646
.B not
 
647
lead to 
 
648
.IR afio (1) 
 
649
exiting with a nonzero code.
 
650
Defined letters are
 
651
.I a
 
652
for ignoring 
 
653
.IR a ll 
 
654
possible warnings on exit, and
 
655
.I m
 
656
for ignoring the warning about 
 
657
.IR m issing
 
658
files, which will occur when, on
 
659
creating an archive, a file whose name was read from the standard
 
660
input is not found.  The default is
 
661
.BR "-1 m" .
 
662
For 
 
663
.I afio 
 
664
versions 2.4.3 and earlier, the default was
 
665
.BR "-1 a" .
 
666
For 
 
667
.I afio 
 
668
versions 2.4.4 and 2.4.5, the default was
 
669
.BR "-1 ''" .
 
670
.TP
 
671
.BI "-2 " maximum-file-size-to-compress
 
672
Do not compress any files which
 
673
are larger than this size when making a compressed archive
 
674
with the
 
675
.B -Z
 
676
option. The default value is 
 
677
.BR "-2 200m"
 
678
(200 Megabytes). This maximum size cutoff lowers the risk that a major portion
 
679
of a large file
 
680
will be irrecoverable due to small media errors.   If a media error occurs
 
681
while reading a file that
 
682
.I afio
 
683
has stored in a compressed form, then
 
684
.I afio
 
685
and
 
686
.I gzip
 
687
will not be able to restore the entire remainder of that file. 
 
688
This is usually an acceptable risk for small files. However for very 
 
689
large files the risk of loosing a large amount of data because
 
690
of this effect will usually be too big.  The special case
 
691
.B "-2 0"
 
692
eliminates any maximum size cutoff.
 
693
.TP
 
694
.BI "-3 " filedescriptor-nr
 
695
Rewind the filedescriptor before invoking the (un)compression program
 
696
if using the 
 
697
.B -Z 
 
698
option. This
 
699
is useful when the 
 
700
.B -P
 
701
and
 
702
.B -Q
 
703
options are used to replace the compression program 
 
704
.I gzip
 
705
with some types of encryption programs in order to make or read an archive
 
706
with encrypted files.  The rewinding is needed to interface
 
707
correctly with some encryption programs that read their key from an open
 
708
filedescriptor.  If the
 
709
.B -P
 
710
program name matches 'pgp' or 'gpg', then the
 
711
.B -3
 
712
option 
 
713
.I must
 
714
be used to avoid 
 
715
.IR afio (1)
 
716
reporting an error.  Use the special case
 
717
.B "-3 0"
 
718
to supress the error message without rewinding any file descriptor.
 
719
The
 
720
.B "-3 0"
 
721
option may also be needed to sucessfully read back encrypted archives
 
722
made with 
 
723
.I afio 
 
724
version 2.4.5 and older.
 
725
.TP
 
726
.B -4
 
727
Write archive in  the `extended ASCII' format which uses 4-byte
 
728
inode numbers.  Archives using the extended ASCII format are
 
729
.B not
 
730
compatible with any other archiver.  This option should not be used
 
731
unless the set of files to be archived contains over 60 thousand hard
 
732
links and all set-internal hard links need to be preserved in the
 
733
archive.  A complete news spool could be an example of such a set of
 
734
files.  For such sets, the standard archive format would not
 
735
necessarily perserve all internal hard links (see the BUGS section).
 
736
.TP
 
737
.B -9
 
738
Do not round down any
 
739
.B -s
 
740
volume sizes to the nearest
 
741
.B -b
 
742
block size.  See the
 
743
.B -s
 
744
option.
 
745
.PP
 
746
.SH NOTES
 
747
Special-case archive names:
 
748
.RS 3
 
749
.TP 3
 
750
.B o
 
751
Specify
 
752
.I \-
 
753
to read or write the standard input or output, respectively.
 
754
This disables multi-volume archive handling.
 
755
.TP
 
756
.B o
 
757
Prefix a command string to be executed with an exclamation mark
 
758
.RI ( ! ).
 
759
The command is executed once for each archive volume,
 
760
with its standard input or output piped to
 
761
.IR afio .
 
762
It is expected to produce a zero exit code when all is well.
 
763
.TP
 
764
.B o
 
765
Use
 
766
.I system:file
 
767
to access an archive in
 
768
.I file
 
769
on
 
770
.IR system .
 
771
This is really just a special case of pipelining.
 
772
It requires a 4.2BSD-style remote shell
 
773
.RI ( rsh (1C))
 
774
and a remote copy of
 
775
.IR afio .
 
776
.TP
 
777
.B o
 
778
A more elaborate case of the above is
 
779
.I [user@]host[%rsh][=afio]:file
 
780
where the optional 
 
781
.I user@
 
782
component specifies the user name on the remote host, the optional
 
783
.I %rsh
 
784
specifies the (local) name of the remote shell command to use,
 
785
and the optional
 
786
.I =afio
 
787
specifies the name of the remote copy of the afio command.
 
788
.TP
 
789
.B o
 
790
Anything else specifies a local file or device.
 
791
An output file will be created if it does not already exist.
 
792
.RE
 
793
.PP
 
794
Recognizes obsolete binary
 
795
.IR cpio (1)
 
796
archives (including those from machines with reversed byte order),
 
797
but cannot write them.
 
798
.PP
 
799
Recovers from archive corruption by searching for a valid magic
 
800
number. This is rather simplistic, but, much like a disassembler,
 
801
almost always works.
 
802
.PP
 
803
Optimizes pathnames with respect to the current and parent
 
804
directories. For example, 
 
805
.I ./src/sh/../misc/afio.c
 
806
becomes
 
807
.IR src/misc/afio.c .
 
808
.SH CONTROL FILES
 
809
.I Afio
 
810
archives can contain so-called control files.  Unlike normal archive
 
811
entries, a control file in not unpacked to the filesystem.  A control
 
812
file has a
 
813
.I label
 
814
and some
 
815
.IR data .
 
816
When 
 
817
.I afio
 
818
encounters a control file in the archive it is reading, it will feed the
 
819
.I label
 
820
and
 
821
.I data
 
822
to a so-called control script.  The control script is supplied by
 
823
the user.  It can perform special actions based on the
 
824
.I label
 
825
and
 
826
.I data
 
827
it receives from 
 
828
.IR afio .
 
829
.PP
 
830
.B Control file labels.
 
831
The control file mechanism can be used for many things.  Examples are
 
832
putting archive descriptions at the beginning of the archive and
 
833
embedding lists of files to move before unpacking the rest or the
 
834
archive.
 
835
.PP
 
836
To distinguish between different uses, the
 
837
.I label
 
838
of a control file should indicate the program that made the contol
 
839
file and the purpose of the control file data.  It should have the
 
840
form
 
841
.PP
 
842
.nf
 
843
   programname.kindofdata
 
844
.fi
 
845
.PP
 
846
where 
 
847
.I programname
 
848
is the name of the backup program that generated the control file, and
 
849
.I kindofdata
 
850
is the meaning of the control file data.  Some examples are
 
851
.PP
 
852
.nf
 
853
   tbackup.movelist  tbackup.updatescript
 
854
   blebberfiler.archivecontents
 
855
   backup_script_of_Joe_User.archivedescription
 
856
.fi
 
857
.PP
 
858
The user-supplied control script should look at the label to decide
 
859
what to do with the control data.  This way, control files with
 
860
unknown labels can be ignored, and afio archives maintain some degree
 
861
of portability between different programs that restore or index them.
 
862
.PP
 
863
Control file labels that are intended to be portable between different
 
864
backup programs could be defined in the future.
 
865
.PP
 
866
.B Making control files.
 
867
When making an archive, afio reads a stream containing the names of the
 
868
files (directories, ...) to put in the archive.  This stream may also
 
869
contain `control file generators', which are lines with the following
 
870
format:
 
871
.PP
 
872
.nf
 
873
    //--sourcename label
 
874
.fi
 
875
.PP
 
876
Here, the //-- sequence signals that a control file is to be made, 
 
877
.I sourcename 
 
878
is the path to a file containing the control file data, and
 
879
.I label
 
880
is the control file label.  The 
 
881
.I sourcename 
 
882
must be a regular file or a symlink to a regular file.
 
883
.PP
 
884
A control file will show up as
 
885
.PP
 
886
.nf
 
887
   //--CONTROL_FILE/label
 
888
.fi
 
889
.PP
 
890
in an archive listing, where 
 
891
.I label
 
892
is the control file label.
 
893
.PP
 
894
.B Control scripts.
 
895
A control script is supplied to afio with the
 
896
.PP
 
897
.BI "  -D " controlscript
 
898
.PP
 
899
command line option.  The
 
900
.I controlscript
 
901
must be an executable program.  The script is
 
902
run whenever
 
903
.I afio
 
904
encounters a control file while doing a
 
905
.B -i -t
 
906
or
 
907
.B -r
 
908
operation.  Afio will supply the control file
 
909
.I label
 
910
as an argument to the script.  The script should read the control file
 
911
.I data
 
912
from its standard input.  If the script exits with a non-zero exit
 
913
status,
 
914
.I afio
 
915
will issue a warning message.
 
916
.PP
 
917
If a contol file is encountered and no
 
918
.B -D
 
919
option is given,
 
920
.I afio
 
921
will issue a warning message.  To suppress the warning message and
 
922
ignore all control scripts,
 
923
.B -D 
 
924
""
 
925
can be used.
 
926
.PP
 
927
An example of a control script is
 
928
.PP
 
929
.nf
 
930
  #!/bin/sh
 
931
  if [ $1 = "afio_example.headertext" ]; then
 
932
    #the headertext control file is supposed to be packed as the first
 
933
    #entry of the archive
 
934
    echo Archive header:
 
935
    cat -
 
936
    echo Unpack this archive? y/n
 
937
    #stdout is still connected to the tty, read the reply from stdout
 
938
    read yn <&1
 
939
    if [ "$yn" = n ]; then
 
940
      #abort
 
941
      kill $PPID
 
942
    fi
 
943
  else
 
944
    echo Ignoring unknown control file.
 
945
    cat - >/dev/null
 
946
  fi
 
947
.fi
 
948
.PP
 
949
.I Afio
 
950
never compresses the control file data when storing it in an archive,
 
951
even when the
 
952
.B -Z
 
953
option is used.  When a control file is encountered by
 
954
.I cpio(1)
 
955
or an
 
956
.I afio
 
957
with a version number below 2.4.1, the data will be unpacked to the
 
958
filesystem, and named
 
959
.I CONTROL_FILE/label
 
960
where
 
961
.I label
 
962
is the control file label.
 
963
.SH BUGS
 
964
There are too many options.
 
965
.PP
 
966
Restricts pathnames to 1023 characters, 
 
967
and 255 meaningful elements (where each element is a pathname 
 
968
component separated by a /).
 
969
.PP
 
970
Cannot archive of files larger than 2 GB,
 
971
even if compiled with large filesystem support.   
 
972
(Pre-2.4.7 versions of afio did not deal with this problem gracefully, 
 
973
see HISTORY file for details.)
 
974
.PP
 
975
Does not use the same default block size as 
 
976
.IR tar (1).
 
977
.IR tar (1)
 
978
uses 10 KB, 
 
979
.I afio
 
980
uses 5 KB by default. Some tape drives only work with a 10 KB block size,
 
981
in that case the 
 
982
.I afio 
 
983
option
 
984
.B \-b 10k
 
985
is needed to make the tape work.
 
986
.PP
 
987
There is no sequence information within multi-volume archives.
 
988
Input sequence errors generally masquerade as data corruption.
 
989
A solution would probably be mutually exclusive with
 
990
.IR cpio (1)
 
991
compatibility.
 
992
.PP
 
993
Degenerate uses of symbolic links are mangled by pathname optimization.
 
994
For example, assuming that "usr.src" is a symbolic link to "/usr/src",
 
995
the pathname "usr.src/../bin/cu" is mis-optimized into "bin/cu" (rather
 
996
than "/usr/bin/cu").
 
997
.PP
 
998
The
 
999
.I afio
 
1000
code for handling floppies
 
1001
.RB ( -F 
 
1002
and 
 
1003
.BR -f " and " -K 
 
1004
options) has buggy error handling.   
 
1005
.I afio
 
1006
does not allow  one to retry a failed floppy write on a different floppy,
 
1007
and it cannot recover from a verify error.
 
1008
If the floppy handling code is used and write or verify errors do occur,
 
1009
it is best to restart
 
1010
.I afio
 
1011
completely.
 
1012
Making backups to floppies should really be done with a more specialised 
 
1013
backup program that wraps
 
1014
.IR afio .
 
1015
.PP
 
1016
The Linux floppy drivers below kernel version 1.1.54 do not
 
1017
allow
 
1018
.I afio
 
1019
to find out about floppy write errors while writing.  If you
 
1020
are running a kernel below 1.1.54, 
 
1021
.I afio
 
1022
will happily fail to write to
 
1023
(say) a write protected disk and not report anything wrong!  The only
 
1024
way to find out about write errors in this case is by watching the
 
1025
kernel messages, or by switching on the verify
 
1026
.RB ( -K )
 
1027
option.
 
1028
.PP
 
1029
The remote archive facilites (host:/file archive names) have not been
 
1030
exhaustively tested. These facilities have seen a lot of real-life use
 
1031
though.  However, there may be bugs in the code for error handling and
 
1032
error reporting with remote archives.
 
1033
.PP
 
1034
An archive created with a command like
 
1035
.I "'find /usr/src/linux -print | afio -o ...'"
 
1036
will not contain the ownership and permissions of the 
 
1037
.I /usr
 
1038
and
 
1039
.I /usr/src
 
1040
directories. If these directories are missing when restoring the archive,
 
1041
.I afio
 
1042
will recreate them with some default ownership and permissions.
 
1043
.PP
 
1044
Afio will not restore time stamps and owner/group information on symlinks.  
 
1045
Afio will often change
 
1046
the time stamp on a directory after having restored it.
 
1047
.PP
 
1048
A restore using decompression will fail if the
 
1049
.I gzip
 
1050
binary used by
 
1051
.I afio
 
1052
is overwritten, by
 
1053
.I afio
 
1054
or by another program, during the restore.  The restore will also fail if
 
1055
any shared libraries needed to start
 
1056
.I gzip
 
1057
are overwritten during the restore.
 
1058
.I afio
 
1059
should not normally be used to overwrite the system files on a running
 
1060
system.  If it is used in this way, a flag like
 
1061
.I -Y /bin/gzip
 
1062
can often be added to prevent failure.
 
1063
.PP
 
1064
The 
 
1065
.B -r
 
1066
option verifies the file contents of the files in the archive 
 
1067
against the files on the filesystem, but does not cross-check details
 
1068
like permission bits on files, nor does it cross-check that archived
 
1069
directories or other non-file entities still exist on the filesystem.
 
1070
.PP
 
1071
There are several problems with archiving hard links.  
 
1072
1) Due to internal limitations, files with hard links cannot be stored
 
1073
in compressed form, unless the
 
1074
.B -l 
 
1075
or
 
1076
.B -U
 
1077
options are used which force each hard linked file to be stored separately.
 
1078
2) By default,
 
1079
unless the
 
1080
.B \-t
 
1081
option is used when writing an archive, 
 
1082
.I afio
 
1083
will store only one copy of each file with hard links in the archive,
 
1084
and re-create the hard links on unpacking the archive.  However, the
 
1085
capacity for storing hard links is limited to 64K files which have
 
1086
hard links.  After processing 64K files with hardlinks (either
 
1087
pointing inside or outside the set of files to be archived), 
 
1088
each instance of a  new hard linked file will be stored separately and
 
1089
separate files will be created when unpacking.  The limitation to 64K
 
1090
files with hard links is not present when the
 
1091
.B \-4
 
1092
option is used. 3) Archives which contain hard links and which were
 
1093
made with older (pre-2.4.4) versions of
 
1094
.I afio
 
1095
or with
 
1096
.I cpio 
 
1097
can not always be correctly unpacked.  This is really a problem in the
 
1098
archives and not in the current version of
 
1099
.IR afio .
 
1100
The risk of incorrect unpacking will be greater if the number of files
 
1101
or hard links in the archives is larger.  Unlike pre-2.4.4 versions of
 
1102
.I afio
 
1103
and
 
1104
.IR cpio ,
 
1105
the current version contains heuristics which greatly reduce the
 
1106
risk of incorrect unpacking.  Use of  the current version of
 
1107
.I afio
 
1108
for unpacking older archives with hard links is strongly encouraged.
 
1109
4) In a selective restore, if the selection predicates do not select
 
1110
the first copy of a file with archive-internal hard links, then all
 
1111
subsequent copies, if selected, will not be correctly restored.  4)
 
1112
Unless the
 
1113
.B \-4 
 
1114
option is used, the inode number fields in the archive headers for
 
1115
files with hard links of the archive will sometimes not contain the
 
1116
actual (least significant 16 bits of) the inode number of the original
 
1117
file. 
 
1118
.PP
 
1119
Some Linux kernels no not allow one to create a hard link to a symbolic link.
 
1120
.I afio 
 
1121
will try to re-create such hard links when unpacking an archive, 
 
1122
but might fail due to kernel restrictions.
 
1123
.PP
 
1124
Due to internal limitations of 
 
1125
.IR afio ,
 
1126
the use of the
 
1127
.B -U
 
1128
option forces the writing of file content with each hard linked file,
 
1129
rather than only once for every set of hard linked files.
 
1130
.PP
 
1131
When it is run without super-user priviliges, 
 
1132
.I afio 
 
1133
is not able to unpack a file into a directory for which it has no write
 
1134
permissions, even if it just created that directory itself.  This can be a
 
1135
problem when trying to restore directory structures
 
1136
created by some source code control tools like RCS.
 
1137
.PP
 
1138
.SH "EXAMPLES"
 
1139
Create an archive with compressed files:
 
1140
.br
 
1141
.I "find .... | afio -o -v -Z /dev/fd0H1440"
 
1142
.PP
 
1143
Install (unpack) an archive with compressed files:
 
1144
.br
 
1145
.I "afio -i -v -Z achive"
 
1146
.PP
 
1147
Install (unpack) an archive with compressed files, protecting newer existing
 
1148
files:
 
1149
.br
 
1150
.I "afio -i -v -Z -n achive"
 
1151
.PP
 
1152
Create an archive with compressed files on floppy disks:
 
1153
.br
 
1154
.I "find .... | afio -o -v -s 1440k -F -Z /dev/fd0H1440"
 
1155
.PP
 
1156
Create an archive with all file contents encrypted by pgp:
 
1157
.br
 
1158
.I "export PGPPASSFD=3"
 
1159
.br
 
1160
.I "find .... | afio -ovz -Z -U -P pgp -Q -fc -Q +verbose=0 -3 3 archive 3<passphrasefile" 
 
1161
.PP
 
1162
Create an archive on recordable CDs using the
 
1163
.I crdrecord
 
1164
utility to write each CD:
 
1165
.br
 
1166
.I "find .... | afio -o -b 2048 -s325000x -v '!cdrecord .... -'"
 
1167
.PP
 
1168
Extract a single named file from an archive on /dev/tape:
 
1169
.br
 
1170
.I "afio -i -v -Z -y /home/me/thedir/thefile /dev/tape"
 
1171
.br
 
1172
(If these do not exist yet, 
 
1173
.I afio 
 
1174
will also create the enclosing directories 
 
1175
.I "home/me/myfiledir" 
 
1176
under current working directory.)
 
1177
.PP
 
1178
Extract files matching a pattern from an archive on /dev/tape:
 
1179
.br
 
1180
.I afio -i -v -Z -y '/home/me/*' /dev/tape
 
1181
.br
 
1182
(If these do not exist yet, 
 
1183
.I afio 
 
1184
will also create the enclosing directories 
 
1185
.I "home/me" 
 
1186
under current working directory.)
 
1187
.PP
 
1188
.SH "SEE ALSO"
 
1189
cpio(1), find(1), tar(1), compress(1), gzip(1).
 
1190
.SH AUTHORS
 
1191
Mark Brukhartz 
 
1192
.I "..!ihnp4!laidbak!mdb"
 
1193
.br
 
1194
Jeff Buhrt 
 
1195
.I "uunet!sawmill!prslnk!buhrt"
 
1196
.br
 
1197
Dave Gymer 
 
1198
.I dgymer@gdcarc.co.uk
 
1199
.br
 
1200
Andrew Stevens 
 
1201
.I as@prg.oxford.ac.uk
 
1202
.br
 
1203
Koen Holtman (current maintainer)
 
1204
.I koen@hep.caltech.edu
 
1205
.br
 
1206
Anders Baekgaard
 
1207
.I ab@osiris.cpk.auc.dk
 
1208
.