System Administration Guide

Chapter 37 Copying UFS Files and File Systems (Tasks)

This chapter describes how to copy UFS files and file systems to disk, tape, and diskettes 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 36, The ufsdump and ufsrestore 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 ufsdump and ufsrestore.

Table 37-1 describes when to use the various backup commands.

Table 37-1 When to Use Various Backup Commands

If You Want To ... 

Then Use ... 

Reference 

Back up file systems to tape 

ufsdump

"How to Do Backups on Cartridge Tape"

Restore file systems from tape 

ufsrestore

"How to Restore a Complete File System"

Transport files to other systems 

pax, tar, or cpio

"Copying Files and File Systems to Tape"

Copy files or file systems to disk 

dd

"How to Clone a Disk (dd)"

Copy files to diskette 

tar

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


Note -

Do not restore files in the /tmp directory even temporarily. The /tmp directory is usually mounted as a TMPFS file system and it does not support UFS file system attributes such as ACLs.


Table 37-2 describe various backup and restore commands.

Table 37-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

Yes 

Yes 

Logical 

pax

Yes 

Yes 

Logical 

dd

No 

Yes 

Physical 

ufsdump/ufsrestore

Yes 

Yes 

Logical 

The following sections describe the advantages and disadvantages of each method and provide examples of how to use the commands.

Copying File Systems to Disk

Two commands are used to copy file systems to disk:

The next section describes how to use the dd command to copy file systems to disk.

Making a Literal File System Copy

The dd command makes a literal (block) copy of a complete UFS file system to another file system or to a tape. By default, the dd command copies its standard input to its standard output.


Note -

Do not use the dd command with variable-length tape drives.


You can specify a device name in place of the standard input or the standard output or both. In this example, 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 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 the standard input and output with this syntax:


$ dd if=input-file of=output-file

For example, to use the keyword=value pairs instead of the redirect symbols in the previous example, you would type:


$ dd if=/floppy/floppy0 of=/tmp/output.file

How to Clone a Disk (dd)

  1. Make sure the source and destination disks have the same disk geometry.

  2. Become superuser.

  3. Create the /reconfigure file on the system with the master disk so that it will recognize the clone disk once it is rebooted.

  4. Shut down the system.


    # init 0
    
  5. Attach the clone disk to the system.

  6. Boot the system.


    ok boot
    
  7. Use the dd command to copy the master disk to the clone disk.


    # dd if=/dev/dsk/device-name of=/dev/dsk/device-name bs=blocksize
    

    if=/dev/dsk/device-name

    Represents the master disk device as the input device. 

    of=/dev/dsk/device-name

    Represents the clone disk device as the output device. 

    bs=blocksize

    Block size. 

  8. Check the new file system.


    # fsck /dev/rdsk/device-name
    
  9. Mount the clone disk's root (/) file system.


    # mount /dev/dsk/device-name /mnt
    
  10. Edit the clone disk's /etc/vfstab to reference the correct device names.

  11. Unmount the clone disk's root (/) file system.


    # umount /mnt
    
  12. Shut down the system.


    # init 0
    
  13. Boot from the clone disk to single-user mode.


    # boot diskn -s
    
  14. Unconfigure the clone disk.


    # sys-unconfig
    

    The system is shut down after it is unconfigured.

  15. Boot from the clone disk again and provide its system information, such as host name, time zone, etc.


    # boot diskn
    
  16. Log in as superuser to verify the system information once the system is booted.


    hostname console login:

Example--Cloning a Disk (dd)


# init 0
ok boot
# dd if=/dev/dsk/c0t0d0s2 of=/dev/dsk/c0t2d0s2bs=100k
# fsck /dev/rdsk/c0t2d0s2
# mount /dev/dsk/c0t2d0s2 /mnt 
# cd /mnt/etc
# vi vfstab
(Modify entries for the new disk)
# cd /
# umount /mnt
# init 0
# boot disk2 -s
# sys-unconfig
# boot disk2

Copying Directories Between File Systems using the cpio Command

You can use the cpio (copy in and out) command to copy individual files, groups of files, or complete file systems. This section describes how to use the cpio command to copy complete file systems.

The cpio command is an archiving program that takes a list of files and copies them into a single, large output file. It inserts headers between the individual files to facilitate recovery. You can use the cpio command to copy complete file systems to another slice, another system, or to a media device such as tape or diskette.

Because the cpio command recognizes end-of-media and prompts you to insert another volume, it is the most effective command (other than ufsdump) to use to create archives that require multiple tapes or diskettes.

During cpio operations, you frequently use commands like ls and find to list and select the files you want to copy and then pipe the output to the cpio command.

How to Copy Directories Between File Systems (cpio)

  1. Become superuser.

  2. Change to the appropriate directory.


    # cd /filesystem1
    
  3. Copy the directory tree using a combination of the find and cpio commands.


    # find . -print -depth | cpio -pdmu /filesystem2
    

    .

    Starts in the current working directory. 

    -print

    Prints the file names. 

    -depth

    Descends the directory hierarchy and prints file names on the way back up. 

    -p

    Creates a list of files. 

    -d

    Creates directories as needed. 

    -m

    Sets the correct modification times on directories. 

    The files from the directory name you specify are copied, and symbolic links are preserved.

    You may also specify the -u option. This option forces an unconditional copy. Otherwise older files will not replace newer files. This may be useful if an exact copy of a directory is desired, and some of the files being copied may already exist in the target directory.

  4. If appropriate, remove the source directory.


    # rm -rf /filesystem1
    
  5. Verify the copy was successful by displaying the destination directory contents.


    # cd filesystem2
    # ls
    

Example--Copying Directories Between File Systems (cpio)


# cd /data1
# find . -print -depth | cpio -pdm /data2
19013 blocks
# cd /data2
# ls
# rm -rf /data1
# cd filesystem2
# ls

See cpio(1) for more information.

Copying Files and File Systems to Tape

The pax, tar, and cpio commands can be used to copy files and file systems to tape. The command 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 37-3 Advantages and Disadvantages of cpio, pax, and tar Commands

Command 

Function 

Advantages 

Disadvantages 

pax

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

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

  • Multi-vendor support

See disadvantages for tar command except, that pax can create multiple tape volumes

tar

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 pathname 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

cpio

Copy files, special files, or file systems that require multiple tape volumes or when you want to copy files from SunOS 5.x systems to SunOS 4.x systems 

  • Packs data onto tape more efficiently than tar

  • Skips over any bad spots in a tape when restoring.

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

  • Creates multiple tape volumes

 

The tape drive and device name you use depend on the hardware and configuration for each system. See "Choosing Which Media to Use" for more information about tape drives and device names.

Copying Files to Tape With tar

Things you should know before copying files to tape with the tar command:

How to Copy Files to a Tape (tar)

  1. Change to the directory that contains the files you want to copy.

  2. Insert a write-enabled tape into the tape drive.

  3. Copy the files to tape with the tar command.


    $ tar cvf /dev/rmt/n filename  ...

    c

    Indicates you want to create an archive. 

    v

    Displays the name of each file as it is archived. 

    f /dev/rmt/n

    Indicates that the archive should be written to the specified device or file. 

    filename ...

    Indicates the files you want to copy. 

    The file names you specify are copied to the tape, overwriting any existing files on the tape.

  4. Remove the tape from the drive and write the names of the files on the tape label.

  5. Verify that the files copied are on the tape using the tar command with the t option, which displays the tape's contents. See "How to List the Files on a Tape (tar)" for more information on listing files on a tar tape.


    $ tar tvf /dev/rmt/n
    

Example--Copying Files to a Tape (tar)

In this example, three files are copied to a tape in tape drive 0.


$ cd /export/home/kryten
$ ls reports
reportA reportB reportC
$ tar cvf /dev/rmt/0 reports
a reports/ 0 tape blocks
a reports/reportA 2 tape blocks
a reports/reportB 5 tape blocks
a reports/reportC 6 tape blocks
$ tar tvf /dev/rmt/n 

How to List the Files on a Tape (tar)

  1. Insert a tape into the tape drive.

  2. Display the tape contents with the tar command.


    $ tar tvf /dev/rmt/n
    

    t

    Lists the table of contents for the files on the tape. 

    v

    Used with the t option, and provides detailed information about the files on the tape.

    f /dev/rmt/n

    Indicates the tape device. 

Example--Listing the Files on a Tape (tar)

In this example, the table of contents for the tape in drive 0 contains three files.


$ tar tvf /dev/rmt/0
drwxr-xr-x 101/10       0 Nov  6 16:31 1996 reports/
-rw-r--r-- 101/10       0 Nov  6 16:31 1996 reports/reportA
-rw-r--r-- 101/10       0 Nov  6 16:31 1996 reports/reportB
-rw-r--r-- 101/10       0 Nov  6 16:31 1996 reports/reportC

How to Retrieve Files From a Tape (tar)

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

  2. Insert the tape into the tape drive.

  3. Retrieve files from the tape using the tar command.


    $ tar xvf /dev/rmt/n filename filename
    

    x

    Indicates that files should be extracted from the specified archive file. All of the files on the tape in the specified drive are copied to the current directory. 

    v

    Displays the name of each file as it is archived. 

    f /dev/rmt/n

    Indicates the tape device containing the archive. 

  4. Verify the files are copied by listing the contents of the current directory.


    $ ls -l 
    

Example--Retrieving the Files on a Tape (tar)

In this example, all files are copied from the tape in drive 0.


$ cd /var/tmp
$ tar xvf /dev/rmt/0
x reports/, 0 bytes, 0 tape blocks
x reports/reportA, 0 bytes, 0 tape blocks
x reports/reportB, 0 bytes, 0 tape blocks
x reports/reportC, 0 bytes, 0 tape blocks
x reports/reportD, 0 bytes, 0 tape blocks
ls -l

Note -

The names of the files extracted from the tape must exactly match the names of the files stored on the archive. If you have any doubts about the names or paths of the files, first list the files on the tape. See "How to List the Files on a Tape (tar)" for instructions.


See tar(1) for more information.

Copying Files to a Tape With pax

This section describes how to copy files with the pax command.

How to Copy Files to a Tape (pax)

  1. Change to the directory that contains the files you want to copy.

  2. Insert a write-enabled tape into the tape drive.

  3. Copy the files to tape with the pax command.


    $ pax -w -f /dev/rmt/0 .
    

    -w

    Copies the current directory contents to tape. 

    -f /dev/rmt/0

    Identifies the tape drive. 

  4. Verify the files are copied to tape by using the pax -l command.


    $ pax -l -f /dev/rmt/0
    
  5. Remove the tape from the drive and write the names of the files on the tape label.

Example--Copying Files to a Tape (pax)


$ pax -w -f /dev/rmt/0 .
$ pax -l -f /dev/rmt/0
filea fileb filec

See pax(1) for more information.

How to Copy All Files in a Directory to a Tape (cpio)

  1. Insert a tape that is not write-protected into the tape drive.

  2. Copy files to a tape using the ls and cpio commands.


    $ ls | cpio -oc > /dev/rmt/n
    

    ls

    Provides the cpio command with a list of file names.

    cpio -oc

    Specifies that cpio should operate in copy-out mode (-o) and write header information in ASCII character format (-c). This ensures portability to other vendor systems.

    > /dev/rmt/n

    Specifies the output file. 

    All of the files in the directory are copied to the tape in the drive you specify, overwriting any existing files on the tape. The total number of blocks copied is displayed.

  3. Verify the files are copied to tape by using the following cpio command.


    $ cpio -civt < /tmp/cpio.file
    
  4. Remove the tape from the drive and write the names of the files on the tape label.

Example--Copying All Files in a Directory to a Tape (cpio)

In this example, all of the files in the directory /export/home/kryten are copied to the tape in tape drive 0.


$ cd /export/home/kryten
$ ls | cpio -oc > /dev/rmt/0
8 blocks
$ cpio -civt < /tmp/cpio.file
drwxr-xr-x  2 kryten  users    0   Oct 24 11:05 1996, letters
drwxr-xr-x  2 kryten  users    0   Oct 24 11:05 1996, memos
drwxr-xr-x  2 kryten  users    0   Nov  8 14:14 1996, reports
8 blocks
$

How to List the Files on a Tape (cpio)


Note -

Listing the table of contents takes as long as it does to read the archive file because the cpio command must process the entire archive.


  1. Insert a tape into the tape drive.

  2. List the files on tape using the cpio command.


    $ cpio -civt < /dev/rmt/n
    

    -c

    Specifies that cpio should read files in ASCII character format.

    -i

    Specifies that cpio should operate in copy-in mode (even though its only listing files at this point).

    -v

    Displays the output in a format similar to the output from the ls -l command.

    -t

    Lists the table of contents for the files on the tape in the tape drive you specify. 

    < /dev/rmt/n

    Specifies the input file of an existing cpio archive.

Example--Listing the Files on a Tape (cpio)

In this example, the table of contents for the tape in drive 0 contains three files.


$ cpio -civt < /dev/rmt/0
drwxr-xr-x  2 rimmer users 0  Oct 28 09:17 1996, answers
drwxr-xr-x  2 rimmer users 0  Oct 28 09:17 1996, sc.directives
drwxr-xr-x  2 rimmer users 0  Oct 28 09:17 1996, tests
8 blocks

How to Retrieve All Files From a Tape (cpio)

If the archive was created using relative path names, the input files are built as a directory within the current directory when you retrieve the files. If, however, the archive was created with absolute path names, the same absolute paths are used to recreate the file on your system.


Caution - Caution -

Using absolute path names can be dangerous because you may overwrite existing files on your system.


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

  2. Insert the tape into the tape drive.

  3. Copy all files from the tape to the current directory using the cpio command.


    $ cpio -icvd < /dev/rmt/n
    

    -i

    Reads in the contents of the tape. 

    -c

    Specifies that cpio should read files in ASCII character format.

    -v

    Displays the output in a format similar to the output from the ls -l command.

    -d

    Create directories as needed. 

    < /dev/rmt/n

    Specifies the output file. 

  4. Verify the files are copied by listing the contents of the current directory.


    $ ls -l
    

Example--Retrieving All Files From a Tape (cpio)

In this example, all files are copied from the tape in drive 0.


$ cd /var/tmp
cpio -icvd < /dev/rmt/0
answers sc.directives tests
8 blocks
$ ls -l

How to Retrieve Specific Files From a Tape (cpio)

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

  2. Insert the tape into the tape drive.

  3. Retrieve a subset of files from a tape using the cpio command.


    $ cpio -icv "*file" < /dev/rmt/n
    

    -i

    Reads in the contents of the tape. 

    -c

    Specifies that cpio should read headers in ASCII character format.

    -v

    Displays the output in a format similar to the output from the ls -l command.

    "*file"

    Specifies that all of the files that match the pattern are copied to the current directory. You can specify multiple patterns, but each must be enclosed in double quotation marks. 

    < /dev/rmt/n

    Specifies the input file. 

  4. Verify the files are copied by listing the contents of the current directory.


    $ ls -l
    

Example--Retrieving Specified Files From a Tape (cpio)

In this example, all files with suffix chapter are copied from tape drive 0.


$ cd /home/smith/Book
$ cpio -icv "*chapter" < /dev/rmt/0
Boot.chapter Directory.chapter Install.chapter Intro.chapter
31 blocks
$ ls -l

See cpio(1) for more information.

How to Copy Files to a Remote Tape Drive (tar and dd)

  1. The following prerequisites must be met to use a remote tape drive:

    • The local hostname (and optionally the username of the user doing the copy) must appear in the remote system's /etc/hosts.equiv file, or the user doing the copy must have his or her home directory accessible on the remote machine, and have the local machine name in $HOME/.rhosts. See hosts.equiv(4) for more information.

    • An entry for the remote system must be in the local system's /etc/inet/hosts file or in the name service hosts file.

  2. To test whether or not you have the appropriate permission to execute a remote command, try the following.


    $ rsh remotehost echo test
    

    If "test" is echoed back to you, you have permission to execute remote commands. If "Permission denied" is echoed, check your setup as described in step 1 above.

  3. To copy files to a remote tape drive use the tar and dd commands.


    $ tar cf - files | rsh remotehost dd of=/dev/rmt/n obs=blocksize
    

    tar cf

    Creates a tape archive and specifies the tape device. 

    - (Hyphen)

    Represents a placeholder for the tape device. 

    files

    Identifies files to be copied. 

    | rsh remotehost

    Pipe tar command to a remote shell to copy the files.

    dd of=/dev/rmt/n

    Represents the output device. 

    obs=blocksize

    Represents the blocking factor. 

  4. Remove the tape from the drive and write the names of the files on the tape label.

Example--Copying Files to a Remote Tape Drive (tar and dd)


# tar cvf - * | rsh mercury dd of=/dev/rmt/0 bs=126b
a answers/ 0 tape blocks
a answers/test129 1 tape blocks
a sc.directives/ 0 tape blocks
a sc.directives/sc.190089 1 tape blocks
a tests/ 0 tape blocks
a tests/test131 1 tape blocks
0+2 records in
0+2 records out

How to Extract Files From a Remote Tape Drive

  1. Change to a temporary directory.


    $ cd /var/tmp
    
  2. To extract files to a remote tape drive use the tar and dd commands.


    $ rsh remotehost dd if=/dev/rmt/n | tar xvBpf -
    

    rsh remotehost

    Is a remote shell that is started to extract the files from the tape device using the dd command.

    dd if=/dev/rmt/n

    Indicates the input device. 

    | tar xvBpf -

    Pipes the output of the dd command to the tar command used to restored the files.

  3. Verify that the files have been extracted.


    $ ls -l /var/tmp
    

Example--Extracting Files From a Remote Tape Drive


$ rsh mercury dd if=/dev/rmt/0 | tar xvBpf -
x answers/, 0 bytes, 0 tape blocks
x answers/test129, 48 bytes, 1 tape blocks
20+0 records in
20+0 records out
x sc.directives/, 0 bytes, 0 tape blocks
x sc.directives/sc.190089, 77 bytes, 1 tape blocks
x tests/, 0 bytes, 0 tape blocks
x tests/test131, 84 bytes, 1 tape blocks
$ ls -l /var/tmp

Copying Files and File Systems to Diskette

Before you can copy files or file systems to diskette, you must format the diskette. See Chapter 13, Formatting and Using Diskettes From the Command Line (Tasks)for information on how to format a diskette.

Use the tar command to copy UFS files to a single formatted diskette.

Use the cpio command if you need to copy UFS files to multiple formatted diskettes. cpio recognizes end-of-media and prompts you to insert the next volume.


Note -

Using the cpio command to copy UFS files to multiple formatted diskettes is not a straightforward procedure because of Volume Management.


Use double-sided high-density 3.5-inch diskettes (diskettes are marked "DS, HD").

Things You Should Know When Copying Files to Diskettes

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

  1. Change to the directory that contains the files you want to copy.

  2. Insert a formatted diskette that is not write-protected into the drive.

  3. Make the diskette available using the volcheck command.

  4. Unmount any file system on the diskette and reformat it.


    $ fdformat -U/vol/dev/aliases/floppy0 
    
  5. Copy the files to diskette using the tar command.


    $ tar cvf /vol/dev/rdiskette0/unlabeled filename ...

    The file names you specify are copied to the diskette, overwriting any existing files on the diskette.

  6. Verify that the files copied are on the diskette using the tar command with the -t option, which displays the diskette's contents. See "How to List the Files on a Diskette (tar)" for more information on listing files.


    $ tar tvf /vol/dev/rdiskette0/unlabeled 
    
  7. Remove the diskette from the drive.

  8. Write the names of the files on the diskette label.

Example--Copying Files to a Single Formatted Diskette (tar)

In this example, two files are copied to a diskette:


$ cd /home/smith
$ ls evaluation*
evaluation.doc   evaluation.doc.backup
$ tar cvf /vol/dev/rdiskette0/unlabeled evaluation*
a evaluation.doc 86 blocks
a evaluation.doc.backup 84 blocks
$ tar tvf /vol/dev/rdiskette0/unlabeled

How to List the Files on a Diskette (tar)

  1. Insert a diskette into the drive.

  2. Run volcheck to make the diskette available.

  3. Use the tar command to list the files on a diskette.


    $ tar tvf /vol/dev/rdiskette0/unlabeled
    

Example--Listing the Files on a Diskette (tar)

In this example, the table of contents for the diskette shows two files:


$ tar tvf /vol/dev/rdiskette0/unlabeled
rw-rw-rw-6693/10  44032 Oct 23 14:54 1996 evaluation.doc
rw-rw-rw-6693/10  43008 Oct 23 14:47 1996 evaluation.doc.backup
$

See tar(1) for more information.

If you need a multiple-volume interchange utility, use the cpio command. The tar command is only a single-volume utility.

How to Retrieve Files From a Diskette (tar)

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

  2. Insert the diskette into the drive.

  3. Run volcheck to make the diskette available.

  4. Use the tar command to retrieve files from a diskette.


    $ tar xvf /vol/dev/rdiskette0/unlabeled
    

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

  5. Verify the files have been retrieved by listing the contents of the current directory.


    $ ls -l
    
  6. Remove the diskette from the drive.

Examples--Retrieving Files From a Diskette (tar)

In this example, all files are copied from the diskette:


$  /home/smith/Evaluations
$ tar xvf /vol/dev/rdiskette0/unlabeled
x evaluation.doc, 44032 bytes, 86 tape blocks
x evaluation.doc.backup, 43008 bytes, 84 tape blocks
$ ls -l

Use the tar command to retrieve individual files from a diskette.


$ tar xvf /vol/dev/rdiskette0/unlabeled filename ...

The file names you specify are extracted from the diskette and placed in the current working directory.

How to Archive Files to Multiple Diskettes

If you are copying large files or file systems onto diskettes, you want to be prompted to replace a full diskette with another formatted diskette. The cpio command provides this capability. The cpio commands you use are the same as you would use to copy files to tape, except you would specify /vol/dev/aliases/floppy0 as the device instead of the tape device name. See "How to Copy All Files in a Directory to a Tape (cpio)" for information on how to use cpio.

Copying Files With a Different Header Format

Archives created with the SunOS 5.x cpio command may 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 using the -H option and one of these arguments:

The syntax for using the header options is:


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 values have the same meaning for input as they do for output. If the archive was created using the -H option, you must use the same option when the archive is read back in or the cpio command will fail, as shown below.

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 using 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 combinations of the options to see which ones allow the archive to be read.

See cpio(1) for a complete list of options.

Retrieving Files Created With the bar Command

To retrieve files from diskettes that were archived using the SunOS 4.x bar command, use the -H bar option to cpio.


Note -

You can only use the -H bar option with -i 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. Use the cpio command to retrieve bar files from a diskette.

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


    $ cpio -ivH bar < /vol/dev/rdiskette/unlabeled