System Administration Guide: Devices and File Systems

ProcedureHow to Restore UFS Files Interactively

  1. Become superuser or assume an equivalent role.

  2. (Optional) Write-protect the tapes for safety.

  3. Insert the volume 1 tape into the tape drive.

  4. Change to a directory that will be used to restore the files to temporarily.

    # cd /var/tmp
  5. Start the interactive restoration.

    # ufsrestore if /dev/rmt/n

    Some informational messages and the ufsrestore> prompt are displayed.

  6. Create a list of files to be restored.

    1. List the contents of a directory.

      ufsrestore> ls [directory-name]
    2. Change to a directory.

      ufsrestore> cd directory-name
    3. Create a list of files and directories that you want to restore.

      ufsrestore> add filenames
    4. (Optional) Remove any directory or file from the list of files to be restored, if necessary.

      ufsrestore> delete filename
  7. (Optional) Display the file names as they are being restored.

    ufsrestore> verbose
  8. Restore the files.

    ufsrestore> extract

    The ufsrestore command asks you which volume number to use.

  9. Type the volume number and press Return. If you have only one volume, type 1 and press Return.

    Specify next volume #: 1

    The files and directories in the list are extracted and restored to the current working directory.

  10. To maintain the mode of the current directory, enter n at the set owner/mode prompt.

    set owner/mode for `.'? [yn] n

    You must wait while the ufsrestore command performs its final cleanup.

  11. Quit the ufsrestore program.

    ufsrestore> quit

    You then see the shell prompt.

  12. Verify the restored files.

    1. List the restored files and directories.

      # ls -l

      A list of files and directories is displayed.

    2. Check the list to be sure that all the files and directories you specified in the list have been restored.

  13. Move the files to the proper directories.

Example 27–2 Restoring UFS Files Interactively

The following example shows how to extract the /etc/passwd and /etc/shadow files from the backup tape.

# cd /var/tmp
# ufsrestore if /dev/rmt/0
ufsrestore> ls
 .sunw/        export/       net/          sbin/         usr/
 Sources/      etools/       opt/          scde/         var/
 b/            home/         ptools/       set/          vol/
 bin           kernel/       pkg/          share/        
 dev/          lib/          platform/     shared/
 devices/      lost+found/   proc/         src/
 etc/          mnt/          rtools/       tmp/
ufsrestore> cd etc
ufsrestore> add passwd shadow
ufsrestore> verbose
verbose mode on
ufsrestore> extract
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/shadow
extract file ./etc/passwd
Add links
Set directory mode, owner, and times.
set owner/mode for `.'? [yn] n
ufsrestore> quit
# cd etc
# mv passwd /etc
# mv shadow /etc
# ls -l /etc