Solaris Transition Guide

tar and cpio Commands

Because they use a nonbinary format, the tar and cpio commands are the only utilities to successfully interchange data between SVR4 implementations. Other backup utilities, such as ufsdump and dd, are unique to the vendor and are not guaranteed to work successfully from one SVR4 implementation to another.

The tar command is unchanged in this release; it accepts the same options and command syntax as the SunOS release 4 command. However, since the device naming scheme has changed in the SunOS release 5.7 software, the tarfile (or device) argument is affected. When using the -f function modifier, specify the device argument as /dev/rmt/unit, where unit is a tape drive number and density. Table 9-16 shows the tape drive density characters in tape device names.

Table 9-16 Tape Drive Density Characters in Tape Device Names




Default "preferred" (highest) density 






The tar command no longer uses /dev/rmt8 as its default output device. When the -f modifier is not used and the TAPE environment variable is not set, the tar command uses the defaults set in the /etc/default/tar file.

The SunOS release 5.7 cpio command supports the SunOS release 4 options and command syntax. cpio has been expanded to include many new options, as listed in Table 9-17.

Table 9-17 Additional cpio Options


Command Available With Option 



cpio -o

Appends files to an archive. 


cpio -i

Attempts to skip corrupt file headers and I/O errors encountered. This option lets you copy files from a medium that is corrupted or out of sequence. 


cpio -o or cpio -p

Follows symbolic links. 


cpio -i, cpio -o, or cpio -p

Special verbose. Prints a dot for each file read or written. This option assures you that cpio is working, without printing all file names.

-C bufsize

cpio -i or cpio -o

Blocks I/O bufsize bytes to the record, where bufsize is a positive integer. When neither -C nor -B is specified, the default buffer size is 512 bytes.

-E filename

cpio -i

Specifies and inputs file containing a list of file names to be extracted from the archive. 

-H header

cpio -i or cpio -o

Reads or writes header information in header format. header can be one of:

bar (read only), crc, CRC, odc, tar, TAR, ustar, or USTAR.

-I filename

cpio -i

Reads filename as an input archive.

-M message

cpio -i -I filename or

cpio -o -O filename

Defines a message to use when switching media. 

-O filename

cpio -o

Directs the output to filename.

-R userid

cpio -i or cpio -p

Reassigns ownership and group information for each file to userid.

Note -

cpio requires one of three mutually exclusive options to specify the action to take: -i (copy in), -o (copy out), or -p (pass).