Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
48.  Restoring Files and File Systems (Tasks) Restoring Files and File Systems How to Restore Files Interactively  Previous   Contents   Next 
   
 

Example--Restoring 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
.:
 .cpr_config   etc/          lost+found/   sbin/         usr/
 TT_DB/        export/       mnt/          sccs/         var/
 b/            home/         net/          share/        vol/
 bin           kernel/       opt/          shared/       ws/
 dev/          lib           platform/     src/          xfn/
 devices/      license/      proc/         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
# 

How to Restore Specific Files Non-Interactively

  1. Become superuser or assume an equivalent role.

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

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

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

    # cd /var/tmp
  5. Restore the file or files.

    # 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

    Specifies one or more individual file names 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 or files are 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 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 all the files and directories you specified in the list have been restored.

  9. Move the files to the proper directories.

Example--Restoring Specific Files Non-Interactively

The following example shows how to restore the passwd and shadow files 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 Dec 12 10:54:45 2001
Dumped from: the epoch
Level 0 dump of / on earth:/dev/dsk/c0t1d0s0
Label: none
Extract directories from tape
Initialize symbol table.
Make node ./etc
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
extract file ./etc/shadow
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

Example--Restoring Files From a Remote Tape Device

You can restore files from a remote tape drive by adding remote-host: to the front of the tape device name, when using the ufsrestore command.

The following example shows how to restore files using a remote tape drive /dev/rmt/0 on the system venus.

# ufsrestore xf venus:/dev/rmt/0 ./etc/hosts

How to Restore a Complete File System

Occasionally, a file system becomes so damaged that you must completely restore it. Typically, you need to restore a complete file system after a disk failure. You might need to replace the hardware before you can restore the software. For information on how to replace a disk, see Chapter 33, SPARC: Adding a Disk (Tasks) or Chapter 34, IA: Adding a Disk (Tasks). Full restoration of a file system such as /export/home can take a lot of time. If you have consistently backed up file systems, you can restore them to their state from the time of the last incremental backup.


Note - You cannot use this procedure to restore the root (/) or /usr file systems. For instructions on restoring these file systems, see "How to Restore the root (/) and /usr File Systems".


  1. Become superuser or assume an equivalent role.

  2. If necessary, unmount the file system.

    # umount /dev/rdsk/device-name
  3. Create the new file system.

    # newfs /dev/rdsk/device-name

    You are asked if you want to construct a new file system on the raw device. Verify that the device-name is correct so you don't destroy the wrong file system.

    For more information, see newfs(1M).

  4. Confirm that the new file system should be created.

    newfs: construct a new file system /dev/rdsk/cwtxdysz:(y/n)? y

    The new file system is created.

  5. Mount the new file system on a temporary mount point.

    # mount /dev/dsk/device-name /mnt
  6. Change to the mount point directory.

    # cd /mnt
  7. (Optional) Write-protect the tapes for safety.

  8. Insert the first volume of the level 0 tape into the tape drive.

  9. Restore the files.

    # ufsrestore rvf /dev/rmt/n

    The level 0 dump is restored. If the dump required multiple tapes, you are prompted to load each tape in numeric order.

  10. Remove the tape and load the next level tape in the drive.

    Always restore tapes starting with 0 and continuing until you reach the highest level.

  11. Repeat Step 8 through Step 10 for each dump level, from the lowest to the highest level.

  12. Verify that the file system is restored.

    # ls
  13. Remove the restoresymtable file.

    # rm restoresymtable

    The restoresymtable file that is created and used by the ufsrestore command to check-point the restore is removed.

  14. Change to another directory.

    # cd /
  15. Unmount the newly restored file system.

    # umount /mnt
  16. Remove the last tape and insert a new tape that is not write-protected in the tape drive.

  17. Make a level 0 backup of the newly restored file system.

    # ufsdump 0uf /dev/rmt/n /dev/rdsk/device-name

    A level 0 backup is performed. Always do an immediate backup of a newly created file system because ufsrestore repositions the files and changes the inode allocation.

  18. Mount the restored file system.

    # mount /dev/dsk/device-name mount-point

    The restored file system is mounted and available for use.

  19. Verify that the restored and mounted file system is available.

    # ls mount-point
 
 
 
  Previous   Contents   Next