Copying UFS Files and File Systems (Tasks)
This chapter describes how to copy UFS files and file systems to disk, tape, and diskettes by using various backup commands.
This is a list of the step-by-step instructions in this chapter.
Commands for Copying File Systems
When you need to back up and restore complete file systems, use the ufsdump and ufsrestore commands described in Chapter 49, 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 as an alternative to the ufsdump and ufsrestore commands.
The following table describes when to use the various backup commands.
Table 50-1 When to Use Various Backup Commands
Task | Command | For More Information |
---|---|---|
Back up file systems to tape | ufsdump | |
Create a file system snapshot | fssnap | |
Restore file systems from tape | ufsrestore | |
Transport files to other systems | pax, tar, or cpio | |
Copy files or file systems between disks | dd | |
Copy files to diskette | tar |
The following table describes various backup and restore commands.
Table 50-2 Summary of Various Backup Commands
Command Name | Aware of File System Boundaries? | Support Multi 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 |
The following sections describe the advantages and disadvantages of each method, and provide step-by-step instructions and examples of how to use the commands.
Copying File Systems Between Disks
Two commands are used to copy file systems between disks:
volcopy
dd
The next section describes how to use the dd command to copy file systems between disks.
Making a Literal File System Copy
The dd command makes a literal (block-level) copy of a complete UFS file system to another file system or to a tape. By default, the dd command copies standard input to standard output.
Note - Do not use the dd command with variable-length tape drives without first specifying an appropriate block size.
You can specify a device name in place of standard input or standard output, or both. In this example, the contents of the diskette are copied to a file in the /tmp directory:
$ dd < /floppy/floppy0 > /tmp/output.file 2400+0 records in 2400+0 records out |
The dd command reports on the number of blocks it reads and writes. The number after the + is a count of the partial blocks that were copied. The default block size is 512 bytes.
The dd command syntax is different from most other commands. Options are specified as keyword=value pairs, where keyword is the option you want to set and value is the argument for that option. For example, you can replace standard input and standard output with this syntax:
$ dd if=input-file of=output-file |
To use the keyword=value pairs instead of the redirect symbols in the previous example, you would type the following:
$ dd if=/floppy/floppy0 of=/tmp/output.file |