Certification Objective 9.03Restoring File System Backups


Certification Objective 9.03—Restoring File System Backups

Exam Objective 6.2: Perform Solaris 10 OS file system restores using the appropriate commands, including restoring a regular file system, the /usr file system, the /(root) file system, and performing interactive and incremental restores for SPARC, x64, and x86 based systems.

You can restore files by using various methods depending on the nature of the storage task at hand. For example, if you know which files or file systems you want to restore, you can restore them non-interactively (that is, by issuing the restoration command in non-interactive mode). On the other hand, if you do not know which files you want to restore and hence want to browse the content on the backup media, you will need to use the restoration command in interactive mode.

Before Restoring Backups

There are a few things you need to be aware of before you start restoring the backups. First, you should know that when you back up files, they are saved relative to the file system to which they belong. For example, consider the /export file system. The /export/gov/senate directory on the disk would be saved to the tape as ./gov/senate. In other words, the path to the jkerry file in the senate directory on the tape would be: ./gov/senate/jkerry.

Second, when you are restoring files, you should always be mindful of the possibility of overwriting the newer versions of files on disk thereby running into conflict with other users. To avoid such risks, it is a good idea to restore to a temporary location, say /var/tmp; after some verifications you can move files, a directory, or a subtree of directories from there to the actual location by using the mv command.

Third, it can happen because of a faulty disk drive or an accident, that you lose the most crucial file systems: root (/), or /usr, or both. In that case, remember that restoring the root (/) or /usr file systems involves booting the system from a CD or the network.

On the Job 

When you wont to restore files to a temporary location before moving them to their actual location, do not use the /tmp directory for this purpose. Recall that the /tmp directory is usually mounted as a TMPFS file system, which does not support attributes of a UFS file system such as ACLs.

You can use the ufsrestore command to restore your backups, which offers you both restoration methods: non-interactive, and interactive.

Using the ufsrestore Command

The ufsrestore command can be used to restore an individual file or a complete file system from a removable medium to a directory. This command has the following syntax:

    ufsrestore <options> [<arguments>] [<filesToRestore>] 

You can use <options> to specify one and only one of the following options:

  • -i. Interactive. Specify to use the ufsrestore command in interactive mode.

  • -r. Recursive. Restore a file system recursively.

  • -R. Resume restoration (with -r) that was previously interrupted. This will prompt for the volume from which to resume.

  • -t. Table of contents. List file names in the storage device, tape, or archive file.

  • -x. Extract the files in non-interactive mode and restore them relative to the file system from which they were backed up.

image from book
Exam Watch

The ufsrestore command used with the -x option will overwrite the existing files. If the file being overwritten is a currently running executable, think of the dire consequences it can have.

image from book

Note the following when you are using the -x option:

  • The -x option is used to restore the partial file systems by using the <filesToRestore> argument.

  • If <filesToRestore> specifies a directory name, the directory is extracted recursively.

  • If you do not specify the value of <filesToRestore> or specify a dot (.) for it, the root directory is used by default—that is, the entire tape will be extracted.

The <arguments> in the ufsrestore command modify the effect of the option. For example, you can use the -f <dumpFile> argument to specify a source device for a restore.

Now that you know how the ufsrestore command works, here are some practical scenarios and their solutions related to using this command.

SCENARIO & SOLUTION

How would you issue the ufsrestore command to display the content of an archive file myArchive.dump?

 ufsrestore -tf myArchive.dump 

How would you issue the ufsrestore command to display the content of a tape device /dev/rmt/0?

 ufsrestore -tf /dev/rmt/0 

How would you issue the ufsrestore command to extract all the files (the directory tree) on the tape drive /dev/rmt/0 and restore them to the current working directory?

 ufsrestore -xf /dev/rmt/0 

If you are restoring the whole file system and it was backed up by using incremental backups, you will need to understand the basic concept of incremental backups and how they are represented by dump levels. (We covered this issue in a previous section.) In this case, always begin restoring from the lowest dump level and work your way to the highest dump level tapes. If you are restoring only a partial file system, select the appropriate dump level tape and restore it.

Remember also that the ufsrestore command creates the restoresymtable file (in the directory in which the command was issued), which it uses to checkpoint the restore. The ufsretore utility uses it to store and retrieve information in order to coordinate the restoration of incremental backups on top of a full backup. This file is created automatically but is not deleted. You have to delete it manually after the restore is complete.

You can also use the ufsrestore command in interactive mode. For example, to restore files from the device /dev/rmt/0 to the current directory, issue the following command:

    ufsrestore -if /dev/rmt/0 

This will display the following prompt:

    ufsrestore >> 

This prompt accepts the commands listed in Table 9-9.

Table 9-9: Commands available for using the ufsrestore command in interactive mode

Command

Description

add <file>

Adds a file (or directory) specified by <file> to the list of files marked for extraction.

cd <directory>

Moves to the directory specified by <directory> in the backup directory hierarchy.

delete <file>

Unmarks a file (or directory) specified by <file> from the list of files to be extracted.

extract

Extracts all marked files. The ufsrestore command will prompt you for the volume number to be used.

help

?

Displays a list of available commands.

ls [<directory>]

Lists the contents of the current directory or the directory specified by <directory>. Entries marked for extraction are prefixed with a *.

marked <directoryName>

Same as ls except that only tiles marked for extraction are listed.

pwd

Displays the working directory in the backup directory hierarchy.

quit

Exit the ufsrestore utility.

verbose

Displays information about the files when they are extracted.

Exercise 9-1: Restoring the root (/) and /usr File Systems

image from book

In this exercise, you will learn how to restore root (/) and /usr file systems to the Solaris systems running on SPARC or x86.

  1. Assume the role of a superuser.

  2. Presumably you lost these file systems because the disk failed, and we assume you booted the system from a CD or from the network. In that case, perform the following steps:

    1. Add a new system disk to the system on which you want to restore the root (/) and /usr file systems.

    2. Create the file system by issuing the newfs command:

          newfs /dev/rdsk/<partitionName> 

    3. Check the new file system with the fsck command:

          fsck /dev/rdsk/<partitionName> 

  3. Mount the file system on a temporary mount point:

        mount /dev/dsk/<deviceName> /mnt 

  4. Change to the mount directory:

        cd /mnt 

  5. Write-protect the tape so that you cannot accidentally overwrite it. This is an optional but important step.

  6. Restore the root (/) file system by performing the following steps:

    1. Load the first volume of the appropriate dump level tape into the tape drive. The appropriate dump level is the lowest dump level of all the tapes that need to be restored. Issue the following command:

          ufsrestore -rf /dev/rmt/<n> 

    2. Remove the tape and repeat step a, if there is more than one tape for the same level.

    3. Repeat steps a and b with the next dump level tapes. Always begin with the lowest dump level, and work your way to the highest dump level tapes.

  7. Verify that the file system has been restored:

        1s 

  8. Delete the restoresymtable file which is created and used by the ufsrestore utility:

        rm restoresymtable 

  9. Change to the root directory and unmount the newly restored file system:

        cd /    umount /mnt 

  10. Check the newly restored file system for consistency:

        fsck /dev/rdsk/<deviceName> 

  11. If you are restoring the root file system, create the boot blocks as shown:

    1. On a SPARC system, issue the following command:

       installboot /usr/platform/sun4u/lib/fs/ufs/bootblk /dev/rdsk/<deviceName> 

    2. On an x86 system, issue the following command:

       installboot /usr/platform/'uname -i'/lib/fs/ufs/pboot /usr/platform/'uname -i' /lib/fs/ufs/bootblk /dev/rdsk/<deviceName> 

  12. Remove the last backup tape, and insert a new tape onto which you could write. Make a dump level 0 backup of the newly restored system by issuing the following command:

        ufsdump 0ucf /dev/rmt/<n> /dev/rdsk/<deviceName> 

    This step is necessary because ufsrestore repositions the files and changes the inode allocations; therefore, the old backup will not truly represent the newly restored file system.

  13. Repeat steps 5 to 10 to restore the /usr file system.

  14. Reboot the system:

        init 6 

    The system is rebooted, and the restored file systems are ready to be used.

image from book

You may be wondering how you can restore a backup that was made from a UFS snapshot that you took by using the fssnap command. The next section provides the answer.




Sun Certified System Administrator for Solaris 10 Study Guide Exams 310-XXX & 310-XXX
Sun Certified System Administrator for Solaris 10 Study Guide Exams 310-XXX & 310-XXX
ISBN: N/A
EAN: N/A
Year: 2005
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net