System Administration Guide: Basic Administration

Copying Files and File Systems to Tape

You can use the tar, pax, and cpio commands to copy files and file systems to tape. The command that you choose depends on how much flexibility and precision you require for the copy. Because all three commands use the raw device, you do not need to format or make a file system on tapes before you use them.

Table 51–3 Advantages and Disadvantages of tar, pax, and cpio Commands

Command 

Function 

Advantages 

Disadvantages 

tar

Use to copy files and directory subtrees to a single tape. 

  • Available on most UNIX operating systems

  • Public domain versions are readily available

  • Is not aware of file system boundaries

  • Full path-name length cannot exceed 255 characters

  • Does not copy empty directories or special files such as device files

  • Cannot be used to create multiple tape volumes

pax

Use to copy files, special files, or file systems that require multiple tape volumes. Or, use when you want to copy files to and from POSIX-compliant systems 

  • Better portability than the tar or cpio commands for POSIX-compliant systems

  • Multiple vendor support

Same disadvantages as the tar command, except that the pax command can create multiple tape volumes

cpio

Use to copy files, special files, or file systems that require multiple tape volumes. Or, use when you want to copy files from SunOS 5.9 systems to SunOS 4.0/4.1 systems 

  • Packs data onto tape more efficiently than the tar command

  • Skips over any bad spots in a tape when restoring

  • Provides options for writing files with different header formats, such as ( tar, ustar, crc, odc, bar), for portability between different system types

  • Creates multiple tape volumes

The command syntax is more difficult than the tar or pax commands

The tape drive and device name that you use depend on the hardware configuration for each system. For more information about tape device names, see Choosing Which Media to Use.