1
'br $Header: /u/buhrt/src/afio/RCS/afio.1,v 2.3 1991/09/25 20:08:33 buhrt Exp $
4
afio \- manipulate archives and files
11
] archive : write archive
16
] archive : install archive
21
] archive : list table-of-contents of archive
26
] archive : verify archive against filesystem
31
] directory [ ... ] : copy files
35
manipulates groups of files, copying them within the (collective)
36
filesystem or between the filesystem and an
40
archives are portable, as they contain only ASCII-formatted
41
header information. They are also compatible with ASCII
49
However, archives made with using
57
reads pathnames from the standard input
65
and writes a table-of-contents to the standard output.
69
installs the contents of an
71
relative to the working directory.
75
reads pathnames from the standard input
76
and copies the files to each
78
Cannot be combined with the
86
and verifies it against the filesystem. This is useful for verifying
89
Creates missing directories as necessary, with permissions
90
to match their parents.
92
Removes leading slashes from pathnames when reading, writing, and cataloging
93
an archive, unless instructed not to.
95
Supports multi-volume archives during interactive operation
100
is not being ignored).
107
when a volume change (tape change, floppy change) is needed, and also when
108
the entire operation is complete. Uses
113
Preserve the last access times (atimes) of the files read when
114
making or verifying an archive.
116
if this option is used,
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.
141
for compatibility with
143
In some cases, notably when using
145
with some tape drives,
147
is needed for compatibility. Note that
149
is the default block size used by
151
so it is usually a good choice if the tape setup is known to work
158
archive blocks between I/O operations. A large
160
is recommended for efficient use with streaming magnetic tape drives, in
161
order to reduce the number of tape stops and restarts.
164
Don't create missing directories.
167
Pad the archive to a multiple of
170
Recognizes the same suffices as
177
for compatibility with
181
Spawn a child process to actually write to the archive; provides
182
a clumsy form of double-buffering.
185
for multi-volume archive support.
188
Change to input file directories. Avoids quadratic filesystem
189
behavior with long similar pathnames. Requires all absolute
190
pathnames, including those for the
198
Follow symbolic links, treating them as ordinary files and directories.
201
Don't generate sparse filesystem blocks on restoring files.
204
creates sparse filesystem blocks (with
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
212
does not make much sense except in a historical way.)
215
Skip corrupt data at the
217
of an archive (rather
218
than complaining about unrecognizable input).
223
write file contents with each hard link.
231
attempt to link files rather than copying them.
234
Mark output files with a common current timestamp
235
(rather than with input file modification times).
238
Protect newer existing files (comparing file modification times).
241
Restrict each portion of a multi-volume archive to
244
option recognizes the same size suffices as
248
denotes a multiple of the
250
block size (and must follow any
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
265
to prompt for the next volume if the specified volume length is reached.
268
option will also cause
270
to prompt if there is a premature EOF while reading the input.
273
will activate this prompting for the next volume on premature EOF without
274
setting a volume length.
275
When writing an archive,
277
will prompt for the next volume on end-of-media, even without
279
being supplied, if the device is capable of reporting end-of-media.
282
specified is not a multiple of the block size set with the
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
293
will write a small block of data, smaller than the
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.
299
Report files with unseen links.
302
Verbose. Report pathnames as they are processed. With
306
style report (including link information).
317
Retain file ownership and setuid/setgid permissions.
318
This is the default for the super-user; he may use
323
Restrict processing of files to names matching shell wildcard 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
331
for more information on shell wildcard pattern matching.
332
The only difference with shell wildcard pattern matching is that in
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
339
option is given, any leading slash in the pattern or the filename is
340
ignored when matching,
347
to supply patterns which are
353
if a filename matches both.
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 '*'.
365
Print execution statistics. This is meant for human consumption;
366
use by other programs is officially discouraged.
369
Do not turn absolute paths into relative paths. That is don't remove
375
option is used, prints the byte offset of the start of each file in
377
If your tape drive can start reading at any position in an
378
archive, the output of
380
can be useful for doing quick selective restores.
382
.BI -D "\ controlscript"
383
Set the control script name to
390
Read file extensions, separated by whitespace, from
392
Files with these extensions are not to be compressed when using the
396
may contain comments preceded by a #.
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
406
will not be compressed.
409
This is a floppy disk,
411
is required. Causes floppy writing in
413
mode under Linux. With kernel version 1.1.54 and above, this allows
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),
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)
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):
432
compression speed factor, used when compressing files with the
435
Factor 1 is the fastest with least compression, 9 is slowest with best
437
The default value is 6. See also the
440
If you have a slow machine or a fast backup medium, you may want to
441
specify a low value for
443
to speed up the backup. On large (>200k) files,
445
typically zips twice as fast as
447
while still achieving a better result than
449
The zip speed for small files is mainly determined by the invocation time
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.
465
Try to continue after a media write error when doing a backup (normal
466
behavior is to abort with a fatal error).
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
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
476
Enter quit to ABORT this backup
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.
483
.BI "-L " Log_file_path
484
Specify the name of the file to log errors and the final totals to.
487
Specifies the maximum amount of memory to use for the temporary storage of
488
compression results when using the
490
option. The default is
492
(2 megabytes). If the compressed version of a file is larger than
495
runs out of virtual memory),
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.
504
instead of the standard
506
for compression and decompression with the
518
to the compression or decompression program used with the
520
option. For passing multiple options, use
522
multiple times. If no
524
flag is present, the standard options are passed. The standard
527
when the program is called for compression and
529
when the program is called for decompression. Use the special case
532
if no options at all are to be passed to the program.
534
.BI -R "\ Disk format command string"
535
This is the command that is run when you enter 2 to reformat the disk after
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
543
Do not ignore a leading slash in the pattern or the file name when matching
551
Only compress a file when using the
553
option if its length is at least
557
This is useful if you have a slow machine or a fast backup medium.
560
typically halves the number of invocations of
562
saving some 30% computation time, while creating an archive
563
that is only 5% longer. The combination
565
typically saves 70% computation time and gives a 20% size increase.
566
The latter combination may be a good alternative to not using
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.
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
580
options. This is useful when the
584
options are used to replace the compression program
586
with an encryption program in order to make an archive with encrypted files.
587
Due to internal limitations of
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.
603
process files whose names match shell wildcard pattern
606
.BR "\-y " and " -W" .
609
Gzip the files on the way out, in, and passing without links
611
.BR -F "\ or" "\ -K" ),
615
in your path. See also the
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.
632
.BI \-1 "\ warnings-to-ignore-on-exit"
635
should exit with a nonzero code after printing warning messages.
636
This option is sometimes useful when calling
638
from inside a backup script or program.
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
649
exiting with a nonzero code.
654
possible warnings on exit, and
656
for ignoring the warning about
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
664
versions 2.4.3 and earlier, the default was
668
versions 2.4.4 and 2.4.5, the default was
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
676
option. The default value is
678
(200 Megabytes). This maximum size cutoff lowers the risk that a major portion
680
will be irrecoverable due to small media errors. If a media error occurs
681
while reading a file that
683
has stored in a compressed form, then
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
692
eliminates any maximum size cutoff.
694
.BI "-3 " filedescriptor-nr
695
Rewind the filedescriptor before invoking the (un)compression program
703
options are used to replace the compression program
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
710
program name matches 'pgp' or 'gpg', then the
716
reporting an error. Use the special case
718
to supress the error message without rewinding any file descriptor.
721
option may also be needed to sucessfully read back encrypted archives
724
version 2.4.5 and older.
727
Write archive in the `extended ASCII' format which uses 4-byte
728
inode numbers. Archives using the extended ASCII format are
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).
738
Do not round down any
740
volume sizes to the nearest
747
Special-case archive names:
753
to read or write the standard input or output, respectively.
754
This disables multi-volume archive handling.
757
Prefix a command string to be executed with an exclamation mark
759
The command is executed once for each archive volume,
760
with its standard input or output piped to
762
It is expected to produce a zero exit code when all is well.
767
to access an archive in
771
This is really just a special case of pipelining.
772
It requires a 4.2BSD-style remote shell
778
A more elaborate case of the above is
779
.I [user@]host[%rsh][=afio]:file
782
component specifies the user name on the remote host, the optional
784
specifies the (local) name of the remote shell command to use,
787
specifies the name of the remote copy of the afio command.
790
Anything else specifies a local file or device.
791
An output file will be created if it does not already exist.
794
Recognizes obsolete binary
796
archives (including those from machines with reversed byte order),
797
but cannot write them.
799
Recovers from archive corruption by searching for a valid magic
800
number. This is rather simplistic, but, much like a disassembler,
803
Optimizes pathnames with respect to the current and parent
804
directories. For example,
805
.I ./src/sh/../misc/afio.c
807
.IR src/misc/afio.c .
810
archives can contain so-called control files. Unlike normal archive
811
entries, a control file in not unpacked to the filesystem. A control
818
encounters a control file in the archive it is reading, it will feed the
822
to a so-called control script. The control script is supplied by
823
the user. It can perform special actions based on the
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
836
To distinguish between different uses, the
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
843
programname.kindofdata
848
is the name of the backup program that generated the control file, and
850
is the meaning of the control file data. Some examples are
853
tbackup.movelist tbackup.updatescript
854
blebberfiler.archivecontents
855
backup_script_of_Joe_User.archivedescription
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.
863
Control file labels that are intended to be portable between different
864
backup programs could be defined in the future.
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
876
Here, the //-- sequence signals that a control file is to be made,
878
is the path to a file containing the control file data, and
880
is the control file label. The
882
must be a regular file or a symlink to a regular file.
884
A control file will show up as
887
//--CONTROL_FILE/label
890
in an archive listing, where
892
is the control file label.
895
A control script is supplied to afio with the
897
.BI " -D " controlscript
899
command line option. The
901
must be an executable program. The script is
904
encounters a control file while doing a
908
operation. Afio will supply the control file
910
as an argument to the script. The script should read the control file
912
from its standard input. If the script exits with a non-zero exit
915
will issue a warning message.
917
If a contol file is encountered and no
921
will issue a warning message. To suppress the warning message and
922
ignore all control scripts,
927
An example of a control script is
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
936
echo Unpack this archive? y/n
937
#stdout is still connected to the tty, read the reply from stdout
939
if [ "$yn" = n ]; then
944
echo Ignoring unknown control file.
950
never compresses the control file data when storing it in an archive,
953
option is used. When a control file is encountered by
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
962
is the control file label.
964
There are too many options.
966
Restricts pathnames to 1023 characters,
967
and 255 meaningful elements (where each element is a pathname
968
component separated by a /).
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.)
975
Does not use the same default block size as
980
uses 5 KB by default. Some tape drives only work with a 10 KB block size,
985
is needed to make the tape work.
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
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
1000
code for handling floppies
1004
options) has buggy error handling.
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
1012
Making backups to floppies should really be done with a more specialised
1013
backup program that wraps
1016
The Linux floppy drivers below kernel version 1.1.54 do not
1019
to find out about floppy write errors while writing. If you
1020
are running a kernel below 1.1.54,
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
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.
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
1040
directories. If these directories are missing when restoring the archive,
1042
will recreate them with some default ownership and permissions.
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.
1048
A restore using decompression will fail if the
1054
or by another program, during the restore. The restore will also fail if
1055
any shared libraries needed to start
1057
are overwritten during the restore.
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
1062
can often be added to prevent failure.
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.
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
1077
options are used which force each hard linked file to be stored separately.
1081
option is used when writing an archive,
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
1092
option is used. 3) Archives which contain hard links and which were
1093
made with older (pre-2.4.4) versions of
1097
can not always be correctly unpacked. This is really a problem in the
1098
archives and not in the current version of
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
1105
the current version contains heuristics which greatly reduce the
1106
risk of incorrect unpacking. Use of the current version of
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)
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
1119
Some Linux kernels no not allow one to create a hard link to a symbolic link.
1121
will try to re-create such hard links when unpacking an archive,
1122
but might fail due to kernel restrictions.
1124
Due to internal limitations of
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.
1131
When it is run without super-user priviliges,
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.
1139
Create an archive with compressed files:
1141
.I "find .... | afio -o -v -Z /dev/fd0H1440"
1143
Install (unpack) an archive with compressed files:
1145
.I "afio -i -v -Z achive"
1147
Install (unpack) an archive with compressed files, protecting newer existing
1150
.I "afio -i -v -Z -n achive"
1152
Create an archive with compressed files on floppy disks:
1154
.I "find .... | afio -o -v -s 1440k -F -Z /dev/fd0H1440"
1156
Create an archive with all file contents encrypted by pgp:
1158
.I "export PGPPASSFD=3"
1160
.I "find .... | afio -ovz -Z -U -P pgp -Q -fc -Q +verbose=0 -3 3 archive 3<passphrasefile"
1162
Create an archive on recordable CDs using the
1164
utility to write each CD:
1166
.I "find .... | afio -o -b 2048 -s325000x -v '!cdrecord .... -'"
1168
Extract a single named file from an archive on /dev/tape:
1170
.I "afio -i -v -Z -y /home/me/thedir/thefile /dev/tape"
1172
(If these do not exist yet,
1174
will also create the enclosing directories
1175
.I "home/me/myfiledir"
1176
under current working directory.)
1178
Extract files matching a pattern from an archive on /dev/tape:
1180
.I afio -i -v -Z -y '/home/me/*' /dev/tape
1182
(If these do not exist yet,
1184
will also create the enclosing directories
1186
under current working directory.)
1189
cpio(1), find(1), tar(1), compress(1), gzip(1).
1192
.I "..!ihnp4!laidbak!mdb"
1195
.I "uunet!sawmill!prslnk!buhrt"
1198
.I dgymer@gdcarc.co.uk
1201
.I as@prg.oxford.ac.uk
1203
Koen Holtman (current maintainer)
1204
.I koen@hep.caltech.edu
1207
.I ab@osiris.cpk.auc.dk