System Administration Guide: Basic Administration

Copying Files With a Different Header Format

Archives that are created with the SunOS 5.9 cpio command might not be compatible with older SunOS releases. The cpio command allows you to create archives that can be read with several other formats. You specify these formats by using the -H option and one of these arguments:

The syntax for using the header options is as follows:


cpio -o -H header-option < file-list > output-archive

How to Create an Archive for Older SunOS Releases

Use the cpio command to create the archive.


$ cpio -oH odc < file-list > /dev/rmt/n

The -H arguments have the same meaning for input as they do for output. If the archive was created with the -H option, you must use the same option when the archive is read back in or the cpio command will fail. The following example includes the cpio error message.

Example—Creating an Archive for Older SunOS Releases


$ find . -print | cpio -oH tar > /tmp/test
 113 blocks
$ cpio -iH bar < /tmp/test
cpio: Invalid header "bar" specified
USAGE:
        cpio -i[bcdfkmrstuvBSV6] [-C size] [-E file] [-H hdr]
            [-I file [-M msg]] [-R id] [patterns]
        cpio -o[acvABLV] [-C size] [-H hdr] [-O file [-M msg]]
        cpio -p[adlmuvLV] [-R id] directory

When you create an archive with different options, always write the command syntax on the media label along with the names of the files or file system on the archive.

If you do not know which cpio options were used when an archive was created, all you can do is experiment with different option combinations to see which ones allow the archive to be read.

For a complete list of options, see cpio(1).

Retrieving Files Created With the bar Command

To retrieve files from diskettes that were archived by using the SunOS 4.0 or 4.1 bar command, use the cpio -H bar command.


Note –

You can use only the -H bar option with the -i option to retrieve files. You cannot create files with the bar header option.


How to Retrieve bar Files From a Diskette

  1. Change to the directory where you want to put the files.

  2. Insert the diskette into the drive.

  3. Make the diskette available.


    $ volcheck
    
  4. Retrieve bar files from a diskette.

    All files on the diskette are copied to the current directory.


    $ cpio -ivH bar < /vol/dev/aliases/floppy0