Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cpio(1) — DG/UX R4.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1)

cat(1)

echo(1)

find(1)

ls(1)

secconfig(1)

tar(1)

ar(4)

cpio(4)

tar(5)



cpio(1)                          DG/UX R4.11                         cpio(1)


NAME
       cpio - copy file archives in and out

SYNOPSIS
       cpio -i[bBcdfkmrsStuUvVxZ6] [-C bufsize] [-E file]
       [-FlowMAClabel[,highMAClabel]] [-H hdr] [-I file [-M message]]
       [-Q query-file] [-R ID] [pattern ...]

       cpio -o[aABcLvVZ] [-C bufsize] [-FlowMAClabel[,highMAClabel]] [-H
       hdr] [-O file [-M message]] [-Q query-file]

       cpio -p[adlLmuUvVxY] [-FlowMAClabel[,highMAClabel]] [-R ID]
       directory

DESCRIPTION
       The -i, -o, and -p options select the action to be performed.  The
       following list describes each of the actions (which are mutually
       exclusive).

       cpio -i (copy in) extracts files from the standard input, which is
       assumed to be the product of a previous cpio -o.  Only files with
       names that match patterns are selected.  Extracted files are
       conditionally created and copied into the current directory tree
       based on the options described below.  The attributes of the files
       will be those of the previous cpio -o.  Owner and group will be the
       same as the current process effective uid and gid unless the current
       user is a user with appropriate privilege.  If this is true, owner
       and group will be the same as those resulting from the previous cpio
       -o.

       cpio -o (copy out) reads the standard input to obtain a list of
       pathnames and copies those files onto the standard output together
       with pathname and status information.  Output is padded to a 512-byte
       boundary by default unless you supply the -B option (for a 5120-byte
       block size) or the -C option (for a user-specified block size).  You
       will achieve an improvement in performance by using a block size that
       is larger than the default.

       cpio -p (pass) reads the standard input to obtain a list of pathnames
       of files that are conditionally created and copied into the
       destination directory tree based on the options described below.

       On a DG/UX system with discretionary access control (DAC), mandatory
       access control (MAC), or capability access control (CAC), cpio by
       default creates a trusted archive.  This archive contains sufficient
       information to completely restore the security attributes on files
       restored from this archive.

   Information Security Features
       NOTE: You must be in real directory mode to properly save and restore
       a multilevel directory.  If your process is in virtual directory mode
       (the default, even for root), only the hidden directories matching
       your process clearance label will be saved and restored.  Also, if
       the archive is made in virtual directory mode with a process at one
       clearance label, and is restored in virtual directory mode by a
       process at a different clearance label, then the files will be
       restored in the wrong hidden directory.  There will also be major
       problems if an archive is made while in one directory mode and then
       restored while in the other, if multilevel directories are involved.
       (If multilevel directories are not involved, then the directory mode
       is irrelevant.)  If you will be saving a multilevel directory, with
       the intent of saving files at all MAC labels, then use the setdirmode
       -r command to set your process to real directory mode both before
       making the archive and also before restoring it.  Be certain to mark
       on the archive tape that it was made while in real directory mode.

       If the trusted archive is restored by a user with appropriate
       privilege, cpio will by default restore all the contents of the
       trusted archive, with the security attributes being set to the values
       contained in the archive, except for existing directories, where the
       default is to leave the security attributes unmodified.  Also, if
       intervening directories are not specifically included on the archive,
       they will not be created unless the -d option is specified.  The -u
       option will cause the security attributes of any existing directory
       to be set to those from the archive.  If you do not specify the -u
       option, the attributes on existing directories will not be updated,
       even though the contents of the existing directories are replaced by
       the contents of a newer directory on the cpio archive.  The -U option
       causes the MAC labels of all restored objects to be set as if they
       were created by the current process i.e. to the current process
       clearance label.

       If the trusted archive is restored by a user without appropriate
       privilege, only files with MAC labels dominated by the clearance of
       the process performing the restore can be restored.  By default, only
       files with a MAC label equal to the current process clearance will be
       restored.  The -U option will cause files with a MAC label dominated
       by the current process clearance to be restored at the user's current
       MAC label, if they do not currently exist at a different MAC label.
       (If they do currently exist at a different label, the unprivileged
       user will not be able to restore them, because  the user will not
       have write access to the file.)  In both cases, a warning message
       will be issued.

       The security version of cpio can read and write archives that do not
       contain any security attributes, i.e., that are identical with those
       created by standard DG/UX.  To accomplish this, the -Z option must be
       used.  When inputting an archive using the -Z option, all files are
       created according to the normal security policy, that is, the files
       are created with the MAC label of the process.  The -Z option may
       only be specified by users with appropriate privilege.  The default
       header type when -Z is selected is the same default used by standard
       DG/UX (when the -c, -H, and -6 options are not specified).

   Options
       -a     Reset access times of input files after they have been copied.
              This option is ineffective on symbolic links, and is often
              ineffective on directories.

       -A     Append files to an archive.  The -A option requires the -O
              option.  Valid only with archives that are files, or that are
              on floppy diskettes or hard disk partitions.

       -b     Reverse the order of the bytes within each word.  (Use only
              with the -i option.)

       -B     Input/output is to be blocked 5120 bytes to the record.  The
              default buffer size is 512 bytes when this and the -C options
              are not used.  If you use the larger block size, the operation
              takes far less time.  The smaller block size is desirable only
              when you are dumping data that you may need on a system whose
              cpio command requires that data be in 512-byte blocks.  (You
              cannot use the -B option with the pass option; -B is
              meaningful only with data directed to or from a character
              special device, for example, /dev/rmt/0.)

       -c     Read or write header information in ASCII character form for
              portability.  The output of cpio -oc complies with the
              extended cpio format described in POSIX and XPG3.  Always use
              this option (or the -H option) when the origin and the
              destination machines are different types (mutually exclusive
              with -H and -6).  The -c option is not valid when making a
              trusted archive.

       -C bufsize
              Input/output is to be blocked bufsize bytes to the record,
              where bufsize is replaced by a positive integer.  The default
              buffer size is 512 bytes when this and -B options are not
              used.  (-C does not apply to the pass option; -C is meaningful
              only with data directed to or from a character special device,
              e.g. /dev/rmt/0.)  Some types of tape drives, including models
              6577 (QIC-150 150MB 1/4" cartridge) and 6590 (8mm 2GB helical
              scan) require that bufsize be a multiple of 512.

       -d     Directories are to be created as needed.

       -E file
              Specify an input file (file) that contains a list of filenames
              to be extracted from the archive (one filename per line).

       -f     Copy in all files except those in patterns.

       -F lowMAClabel[,highMAClabel] (only if MAC is present)
              Specify the inclusive MAC label range of the files that cpio
              will backup, restore or copy.  The MAC label of the invoking
              process must dominate both the lowMAClabel and the
              highMAClabel.  The highMAClabel must dominate the
              lowMAClabel.  If the highMAClabel is omitted, then the
              lowMAClabel is also the high end of the MAC label range.

       -H hdr Read or write header information in hdr format.  Always use
              this option or the -c option when the origin and the
              destination machines are different types (mutually exclusive
              with -c and -6).  Valid values for hdr are:
              bin    binary header (the default if DAC, MAC, and CAC are
                     absent)
              odc    ASCII header with small device numbers (the same as -c)
              asc    the new "portable" format.  This format is produced by
                     the -c option on some other System V.4 systems.
              crc    ASCII header with expanded device numbers and an
                     additional per-file checksum
              ustar  IEEE/P1003 Data Interchange Standard header and format
              tar    tar header and format
              trsb   DG/UX information security binary header (the default
                     if DAC, MAC, or CAC is present)

       -I file
              Read the contents of file as an input archive.  If file is a
              character special device, and the current medium has been
              completely read, replace the medium and press RETURN to
              continue to the next medium.  This option is used only with
              the -i option.

       -k     Attempt to skip corrupted file headers and I/O errors that may
              be encountered.  If you want to copy files from a medium that
              is corrupted or out of sequence, this option lets you read
              only those files with good headers.  (For cpio archives that
              contain other cpio archives, if an error is encountered cpio
              may terminate prematurely.  cpio will find the next good
              header, which may be one for a smaller archive, and terminate
              when the smaller archive's trailer is encountered.)  Used only
              with the -i option.

       -l     Whenever possible, link files rather than copying them.
              (Usable only with the -p option.)

       -L     Follow symbolic links.  The default is not to follow symbolic
              links.

       -m     Retain previous file modification time.  This option is
              ineffective on symbolic links, and is often ineffective on
              directories.

       -M message
              Define a message to use when switching media.  When you use
              the -O or -I options and specify a character special device,
              you can use this option to define the message that is printed
              when you reach the end of the medium.  One %d can be placed in
              message to print the sequence number of the next medium needed
              to continue.

       -O file
              Direct the output of cpio to file.  If file is a character
              special device and the current medium is full, replace the
              medium and type a carriage return to continue to the next
              medium.  Use only with the -o option.

       -Q query-file
              Specify query-file as the file from which to read input from
              the operator.  Normally, cpio writes operator messages to
              stderr and reads operator responses from /dev/tty.  This
              option allows operator input to be read from an alternate
              source such as fifo-special file.  This is very useful when
              running cpio from cron(1M) since cron jobs have no controlling
              tty.  For example,

              find /foo -print | cpio -o -Q /tmp/fifo >/dev/rmt/0 2>/dev/console

              would backup directory foo to tape /dev/rmt/0.  Error messages
              and operator queries would be written to the console, and
              operator input would be read from the fifo file /tmp/fifo.
              Running this command from a cron job would allow you to send
              cpio output to the console without having to take control of
              the console for input.  Operator queries from cpio (such as
              requests for the next tape) could be answered by echoing
              responses to /tmp/fifo.

       -r     Interactively rename files.  If the user types a carriage
              return alone, the file is skipped.  If the user types a ``.''
              the original pathname will be retained.  (Not available with
              cpio -p.)

       -R ID  Reassign ownership and group information for each file to user
              ID (ID must be a valid login ID from /etc/passwd).  This
              option is valid only for a user with appropriate privilege.

       -s     Swap bytes within each half word.

       -S     Swap halfwords within each word.

       -t     Print a table of contents of the input.  No files are created
              (mutually exclusive with -V).

       -u     Copy unconditionally (normally, an older file will not replace
              a newer file with the same name).  When DAC, MAC, or CAC is
              present and a user with appropriate privilege is restoring an
              archive, update the security attributes of any existing
              directory with the attributes from the cpio archive.  Note
              that if the -u option is omitted, the security attributes
              (including the permission bits) of an existing directory are
              not updated from the cpio archive.

       -U (only if MAC is present)
              This option causes the MAC label on the restored object to be
              set to the clearance label of the invoking process, rather
              than to the MAC label saved on the cpio archive.  For a
              process without appropriate privilege, if the MAC label of the
              file to be restored is dominated by the current process
              clearance, then cpio restores the file at the current process
              clearance label.  If the file's MAC label is not dominated by
              the current process clearance label, then the file is not
              restored.

              For a process with appropriate privilege, all files are
              restored at the current process clearance label.  If the
              contents of a multilevel directory is being restored, then the
              hidden directories retain their original MAC labels, but all
              their contents are restored to the process clearance label.
              If a file has a MAC range and no MAC label, then cpio sets the
              file's MAC range to the process clearance range and the file's
              MAC label to the process clearance label.  In the case of a
              process with appropriate privilege, when cpio sets a file's
              label or range differently from what it was on the archive,
              cpio writes a warning message to standard error.

              The -U option may be used with both the -i and -p options.

       -v     Verbose: causes a list of file names to be printed.  When this
              option is used with the -t option, the table of contents looks
              like the output of an ls -l command [see ls(1)].

       -V     Special Verbose: print a dot for each file read or written.
              Useful to assure the user that cpio is working without
              printing out all file names.

       -x     Remove any existing file before loading the replacement.
              Normally, cpio keeps an existing file on disk under a
              temporary filename until a replacement is entirely loaded.

       -Y     Create symbolic links instead of copying files.  (This option
              can only be used with the -p option).

       -Z (only if DAC, MAC, or CAC is present)
              Assume the same header format used by the traditional DG/UX
              system.  The user must have appropriate privilege to use this
              option.  Specifically cpio -o will not archive any security
              attribute, e.g.: MAC label, MAC range (if MAC is present),
              extended access ACL, and default ACL (if DAC is present).

       -6     Process a UNIX System Sixth Edition archive format file.  Use
              only with the -i option (mutually exclusive with -c and -H)).

       NOTE: cpio assumes four-byte words.

       If, when writing to a character device (-o) or reading from a
       character device (-i), cpio reaches the end of a medium and the -O
       and -I options aren't used, cpio will print the following message:

              To continue, type device/file name when ready.

       To continue, you must replace the medium and type the character
       special device name (/dev/rmt/0 for example) and press RETURN.  You
       may want to continue by directing cpio to use a different device.
       For example, if you have two floppy drives you may want to switch
       between them so cpio can proceed while you are changing the floppies.
       (Simply pressing RETURN causes the cpio process to exit.)

EXAMPLES
       The following examples show three uses of cpio.

       When standard input is directed through a pipe to cpio -o, it groups
       the files so they can be directed (>) to a single file (../newfile).
       The -c option insures that the file will be portable to other
       machines (as would the -H option).  On a DG/UX system with DAC, MAC,
       or CAC, you must specify the -Z option to be able to specify the -c
       or the -H option.  Instead of ls(1), you could use find(1), echo(1),
       cat(1), and so on, to pipe a list of names to cpio.  You could direct
       the output to a device instead of a file.

              ls | cpio -ocZ > ../newfile

       cpio -i uses the output file of cpio -o (directed through a pipe with
       cat in the example below), extracts those files that match the
       patterns (memo/a1, memo/b*), creates directories below the current
       directory as needed (-d option), and places the files in the
       appropriate directories.  The -c option is used if the input file was
       created with a portable header.  If no patterns were given, all files
       from newfile would be placed in the directory.

              cat newfile | cpio -icd "memo/a1" "memo/b*"

       cpio -p takes the file names piped to it and copies or links (-l
       option) those files to another directory (newdir in the example
       below).  The -d option says to create directories as needed.  The -m
       option says retain the modification time.  The destination directory,
       newdir, must exist.

              find . -print | cpio -pdlmv newdir

       Note that when you use cpio in conjunction with find, if you use the
       -L option with cpio then you must use the -follow option with find
       and vice versa.  Otherwise there will be undesirable results.

SEE ALSO
       ar(1), cat(1), echo(1), find(1), ls(1), secconfig(1), tar(1), ar(4),
       cpio(4), appropriateprivilege(5), capdefaults(5), tar(5).

NOTES
       On a system with DG/UX information security, appropriate privilege is
       granted by having one or more specific capabilities enabled in the
       effective capability set of the user.  See the capdefaults(5) man
       page for the default capabilities for this command.

       On a generic DG/UX system, appropriate privilege is granted by having
       an effective UID of 0 (root).  See the appropriateprivilege(5) man
       page for more information.

       patterns are regular expressions given in the filename-generating
       notation of sh(1).  In patterns, meta-characters ?, *, and [...]
       match the slash (/) character, and backslash (\) is an escape
       character.  Multiple patterns may be specified and if no patterns are
       specified, the default for patterns is * (i.e., select all files).  A
       ! meta-character means not.  For example, the !abc* pattern would
       exclude all files that begin with abc.  However, multiple patterns
       with ! do not work well.  Use the -f option and multiple patterns
       without ! instead.  Each pattern must be enclosed in double quotes;
       otherwise, the name of a file in the current directory might be used.

       Consider carefully whether to use the -depth option of find(1) to
       generate pathnames for cpio.  Directory attributes may not be
       preserved if you use -depth.  The contents of read-only directories
       may not be loaded if you do not use -depth.

       On a system with DG/UX information security, tape devices are
       controlled devices, and the nonprivileged user may not have complete
       access to them.  By default, all users have write access to tape
       devices, but only privileged users have read access.  This is because
       all tape devices are assigned a MAC range of from IMPLEMENTATION_LO
       to IMPLEMENTATION_HI.  The system administrator may allow different
       access by resetting these values.

       An archive created with the -H asc option on a Release 5.4 DG/UX
       system cannot be read on a Release 4.3 DG/UX system.

       DG/UX System releases prior to Release 5.4 do not understand symbolic
       links.  The result of copying in a symbolic link on an older release
       will be a regular file that contains the pathname of the referenced
       file.

       Pathnames are restricted to 256 characters for the binary and -H odc
       header formats.  Otherwise, pathnames are restricted to 1024
       characters.

       Only a user with appropriate privilege can copy special files.

       Blocks are reported in 512-byte quantities.

       If a file has 000 permissions, contains more than 0 characters of
       data, and the user does not have appropriate privilege, the file will
       not be saved or restored.

       cpio -i without -k determines the header format by examining the
       archive, ignoring -c and -H hdr.  cpio -ik without -c or -H hdr
       determines the header format by examining the archive, but does not
       consider ustar or tar formats to avoid false matches.  cpio -ik with
       -c or -H hdr only considers the user-supplied header format.


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026