System Administration Guide

How to Restore Specific Files

  1. Become superuser.

  2. Write-protect the tape for safety.

  3. Put the backup tape in the tape drive.

  4. Change to a directory for restoring files temporarily.


    # cd /var/tmp
    

    If you want to restore the files to a different directory, substitute the directory name for /var/tmp in this step.

  5. Use the ufsrestore command to restore the file.


    # ufsrestore xvf /dev/rmt/n filename ...

    x

    Tells ufsrestore to copy specific files or directories in the filename argument.

    v

    Displays the file names as they are restored. 

    f /dev/rmt/n

    Identifies the tape device name. 

    filename ...

    One or more individual file or directory names separated by spaces, for example: ./export/home/user1/mail ./export/home/user2/mail.

  6. Type the volume number where files are located and press Return.


    Specify next volume #: 1
    

    The file is restored to the current working directory.

  7. To keep the mode of the current directory unchanged, type n and press Return at the set owner/mode prompt.


    set owner/mode for '.'? [yn] n
    
  8. Verify the file is restored.

    1. List the current directory.


      # ls -l filename
      

      A listing for the file is displayed.

    2. Move the file to the proper directory.


      # mv filename /directory/filename
      

Example--Restoring Specific Files

In this example, the passwd and shadow files are restored to the /var/tmp directory.


# cd /var/tmp
# ufsrestore xvf /dev/rmt/0 ./etc/passwd ./etc/shadow
Verify volume and initialize maps
Media block size is 126
Dump   date: Wed Nov 06 15:21:10 1996
Dumped from: the epoch
Level 0 dump of / on pluto:/dev/dsk/c0t3d0s0
Label: none
Extract directories from tape
Initialize symbol table.
Warning: ./etc: File exists
Extract requested files
You have not read any volumes yet.
Unless you know which volume your file(s) are on you should start 
with the last volume and work towards the first.
Specify next volume #: 1
extract file ./etc/passwd
Add links
Set directory mode, owner, and times.
set owner/mode for `.'? [yn] n
# cd etc
#  mv passwd /etc
# mv shadow /etc
# ls -l etc