fdfit(SMT) 6 January 1993 fdfit(SMT) Name fdfit - fits file archives onto media volumes Syntax fdfit [options] ... size packages ... Options -f format The files are saved in a format archive. The default format is the first listed in /etc/fdformats, and by convention is tar(C). A number may be appended to format; the meaning of that number depends on format but usually indicates the block- ing factor. For example, a format of tar20 means that tar is blocked at 20. The archive formats listed in /etc/fdformats include: tar[b] tar format, blocked b cpio [c][B] cpio format, either binary or ASCII (c), and either default blocking or 5120-byte records (B) ar ar(CP) archive dd[obs] dd(C) format, with an output record size of obs bytes -o pattern pattern is the naming convention used for the output files. Every time ``#'' appears in pattern, the two-digit number of the volume is substituted. There must be at least one ``#'' in pattern; the default is ``#.fd''. Volumes are numbered start- ing at one (``01''); if there are any files too big to fit on a single volume, these are listed as volume ``00''. Any old files following the naming pattern are removed. -q does not complain about absolute pathnames, even if they are not recommended for format -e exits successfully even if some of the files in the packages could not be found -v prints, on the standard output, a table summarizing the arrangement chosen and the efficiency achieved -F formatsfile alternate list of format descriptions; the default is /etc/fdformats -O algorithm specifies the default arranging algorithm: n Next file. If the next file in the input list does not fit on the current volume, the current volume is finished and a new volume started. This preserves the order of the files but may waste volumes. f First fit. The first file that fits on the current volume is chosen for that volume. Only when none of the files fit is the current volume finished and a new volume started. b Biggest fit. Similar to algorithm f, except that the largest file possible is chosen. s Smallest fit. Identical to algorithm b, except that the smallest file possible is chosen. : Each package starts on a new volume. + After one package is finished, the next package may be started on that volume. Note that the default algorithm can be overridden on a package-by-package basis. The initial default algorithm is ``f+''. -c checks to see if each package fits on exactly one volume. No output files are generated unless an explicit pattern is given, and all algorithms are ignored. -l label The file named label (which is a pattern similar to -o pattern) is the first file on each volume. If label does not exist, it is created with zero length and a mode of 0444 (only read access for all). If label does exist, it must be a regular file; whatever size label has is used. size, which must be given after all options, is the size of each volume in bytes. A suffix of ``k'' multiplies the number by 1024, ``b'' by 512, and ``w'' by 2. packages are collections of files that are to be arranged as an indivisi- ble unit. If the ``:'' algorithm modifier is in effect, each package starts a new volume; otherwise (``+'') packages may share volumes. At least one package must be described after size: file The files in this package are listed in file; the package has the default algorithm applied to it. A file of ``-'' means the standard input. -p [algorithm] file Same as above, except that algorithm (if given) is used instead of the default. -P [algorithm] files ... Similar to -p, except that the named files are the package. Description fdfit tries to arrange groups (``packages'') of files onto the fewest number of media volumes while avoiding splitting any file across two or more media volumes. Packages are not intermixed, and all links to a file within a package are placed on the same volume. Each volume has a capa- city of size bytes, and is written in a specified format, such as tar(C) or cpio(C). An arbitrary number of packages may be given. The packages are dealt with on a one-by-one basis, with each package being completely arranged before the next package is started. The algorithm used to arrange each package may be individually specified. Whether or not a package can start on the same volume that holds the end of the previous package may also be specified. The output of fdfit is a series of files; the first file lists the files that belong on volume one, the second lists the files for volume two, and so on (up to a limit of 100 volumes). Notes Links in packages arranged by the ``n'' algorithm are usually scrambled. No effort is made to ensure that directories occur in the arrangement before any files contained in them. Some formats are inherently non-portable. Furthermore, some of the port- able formats, such as tar, have slightly different overheads on different machines. Under obscure conditions, linked files in large packages may cause infin- ite looping. Format file An fdformats file describes a file archiving format to fdfit(SMT). fdfit only understands distributed dictionary archives, such as tar(C), cpio(C), and ar(CP). Each line in an fdformats file describes a separate format. The format is in the form: fdformats volhdr filhdr volblk filrnd [+] [/] [type[size]]... Empty lines, and lines beginning with ``*'', are ignored. The first field, format, names the archive being described. format is an alphabetic name; no digits or non-letters are allowed. The next four fields are decimal numbers giving the critical values: volhdr the overhead for each volume (floppy). This is the sum of the sizes of the volume header and trailer blocks. filhdr the overhead for each file (element) in the archive. This is the sum of the sizes of the element header and trailer blocks, and may be dependent on the length of the file's name. If so, a ``+'' should be specified in the miscellaneous fields section at the end of the line. volblk the volume blocking factor. The number of bytes written to each volume is always a multiple of this size. filrnd the file rounding boundary. Each element in the archive, with its header and trailer, is rounded up to the next such bound- ary. Each of these values may have a suffixed unit of ``w'', ``b'', or ``k'', indicating multiplication of the number by 2, 512, and 1024, respec- tively. In addition, each number may be prefixed by ``#''. This causes the num- ber suffixed to format, as specified by the user with the -f format flag to fdfit, to be used instead of the value given in fdformats. If the value in fdformats is suffixed with a unit, the value from -f format is multiplied as indicated, ignoring any unit the user specified. But when fdformats does not indicate a unit, any unit indicated with -f format is used. After the four values is a miscellaneous information section. If this contains a ``+'', then the length of a file's name must be added to that file's filhdr. A ``/'' says that absolute pathnames are not a problem in this format. The other fields in the miscellaneous section are a single character type optionally followed by a size value. The type indicates that a special file is correctly saved in a format archive: b block special device c character special device d directory n name space entry, such as semaphores and shared data regions p named pipes (FIFO's) & links to previously saved files If size is a number (which may have a unit suffix), the type special file is always saved as if it were size bytes long. A size of ``#'' uses the actual file size obtained from stat(S). Otherwise, when no size is specified, zero (0) is assumed; the special file is completely described by the element header and trailer blocks. Format file notes Unpredictable results happen when both ``+'' and ``&'' are specified. The meaning of ``/'' is subjective; most archiving programs archive abso- lute pathnames, but the behavior on extraction is undesirable (extreme measures like chroot(C) must be employed). See also ar(CP), cpio(C), dd(C), tar(C)