System Administration Guide, Volume 1

Copying Files and File Systems to Diskette

Before you can copy files or file systems to diskette, you must format the diskette. See Chapter 16, 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.


    $ volcheck
    
  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)

The following example copies two files 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.


    $ volcheck
    
  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)

The following example lists the files on a diskette.


$ tar tvf /vol/dev/rdiskette0/unlabeled
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
$

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.


    $ volcheck
    
  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)

The following example retrieves all the files from a 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

The following example retrieves an individual file from a diskette.


$ tar xvf /vol/dev/rdiskette0/unlabeled evalutation.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. See "How to Copy All Files in a Directory to a Tape (cpio)" for information on how to use cpio.