Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
50.  Copying UFS Files and File Systems (Tasks) Copying Files and File Systems to Diskette How to Copy Files to a Single Formatted Diskette (tar)  Previous   Contents   Next 
   
 

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

The following example shows how to copy two files to a diskette.

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

How to List the Files on a Diskette (tar)

  1. Insert a diskette into the drive.

  2. Make the diskette available.

    $ volcheck
  3. List the files on a diskette.

    $ tar tvf /vol/dev/aliases/floppy0

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

The following example shows how to list the files on a diskette.

$ volcheck
tar tvf /vol/dev/aliases/floppy0
rw-rw-rw-6693/10  44032 Jun  9 15:45 evaluation.doc
rw-rw-rw-6693/10  43008 Jun  9 15:55 evaluation.doc.backup
$

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. Make the diskette available.

    $ volcheck
  4. Retrieve files from the diskette.

    $ tar xvf /vol/dev/aliases/floppy0

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

  5. Verify that the files have been retrieved.

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

Examples--Retrieving Files From a Diskette (tar)

The following example shows how to retrieve all the files from a diskette.

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

The following example shows how to retrieve an individual file from a diskette.

$ volcheck
$ tar xvf /vol/dev/aliases/floppy0 evaluation.doc
x evaluation.doc, 44032 bytes, 86 tape blocks
$ ls -l

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.

For information on how to use the cpio command, see "How to Copy All Files in a Directory to a Tape (cpio)".

Copying Files With a Different Header Format

Archives created with the SunOS 5.9 cpio command might 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 by using the -H option and one of these arguments:

  • crc or CRC - ASCII header with checksum

  • ustar or USTAR - IEEE/P1003 Data Interchange

  • tar or TAR - tar header and format

  • odc - ASCII header with small device numbers

  • bar - bar header and format

The syntax for using the header options is as follows:

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 arguments have the same meaning for input as they do for output. If the archive was created by 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 in the following example.

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 by 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.

For a complete list of options, see cpio(1).

 
 
 
  Previous   Contents   Next