System Administration Guide: Devices and File Systems

Commands for Copying File Systems

When you need to back up and restore complete UFS file systems, use the ufsdump and ufsrestore commands described in Chapter 28, UFS Backup and Restore Commands (Reference). When you want to copy or move individual files, portions of file systems, or complete file systems, you can use the procedures described in this chapter instead of the ufsdump and ufsrestore commands.

The following table describes when to use the various backup commands.

Table 29–1 When to Use Various Backup Commands

Task 

Command 

For More Information 

Back up UFS file systems to tape. 

ufsdump

How to Back Up a UFS File System to Tape

Create a file system snapshot. 

fssnap

Chapter 26, Using UFS Snapshots (Tasks)

Restore UFS file systems from tape. 

ufsrestore

How to Restore a Complete UFS File System

Transport files to other systems. 

pax, tar, or cpio

Copying Files and File Systems to Tape

Copy files or file systems between disks. 

dd

How to Copy a Disk (dd)

Copy files to diskette. 

tar

How to Copy Files to a Single Formatted Diskette (tar)

The following table describes various backup and restore commands.

Table 29–2 Summary of Various Backup Commands

Command Name 

Aware of File System Boundaries? 

Supports Multiple Volume Backups? 

Physical or Logical Copy? 

volcopy

Yes 

Yes 

Physical 

tar

No 

No 

Logical 

cpio

No 

Yes 

Logical 

pax

Yes 

Yes 

Logical 

dd

Yes 

No 

Physical 

ufsdump/ufsrestore

Yes 

Yes 

Logical 

fssnap

N/A 

N/A 

Logical 

The following table describes the advantages and disadvantages of some of these commands.

Table 29–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

  • Length of full path name cannot exceed 255 characters

  • 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 systems running current Solaris releases systems to systems running SunOS 4.0/4.1 releases. 

  • 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 following sections describes step-by-step instructions and examples of how to use these commands.