C H A P T E R 7

Recovering File Systems

This chapter describes how to recover data when a SAM-QFS file system is corrupted or lost. The procedures vary, depending on the type of file system and whether you have recent `samfsdump`(1M) output for the file system. You might require assistance from your ASP or Sun Microsystems customer support.

This chapter contains the following sections

- Recovering a SAM-QFS File System With a Metadata Dump File

- Recovering a SAM-QFS File System Without a Dump File

##

Recovering a SAM-QFS File System With a Metadata Dump File

If you have `samfsdump`(1M) metadata output for a file system, you can use the `samfsrestore`(1M) command or File System Manager to recover a file system that has been corrupted, accidentally remade, or destroyed. For details about the syntax and options used in the procedure, see the `samfsdump`(1M) man page or the File System Manager online Help.

### To Restore a File System Using File System Manager

1. From the Servers page, click the name of the server on which the file system that you want is located.

The File Systems Summary page is displayed.

2. Select the radio button next to the file system for which you want to restore files.

3. From the Operations drop-down menu, choose Restore.

The Restore File System page is displayed.

4. If the metadata snapshot file is not displayed as a link in the Metadata Snapshot Summary table, make the snapshot available by selecting the radio button next to it and clicking Make Available for Browsing.

Note - If a dump file has been created using the `-H` option with the `samfsdump` command, it cannot be indexed and cannot be restored with File System Manager. For more information see the `samfsdump`(1M) man page.

5. Browse the metadata snapshot file by doing either of the following in the Metadata Snapshot Summary table:

- Click the metadata snapshot file.

- Select the radio button next to the metadata snapshot file and click Show Contents.

The Restore File System page is refreshed, and the top-level items in the selected metadata snapshot are displayed in the Metadata Snapshot Entries table.

6. In the Restore type, select the Entire File System option.

7. From the Online Status After Restoring menu, choose the actions that you want the file system to take after completing the restore process.

8. Click Restore.

### To Restore a File System Using the Command Line Interface

1. Use the `cd`(1M) command to change to the mount point for the file system or to the directory in which you want to restore the file system.

| Caution - Consider restoring the file system first into a temporary directory and verifying that the restoration succeeds before restoring directly into the existing file system. This removes the risk of destroying the current file system before you can be sure the restoration is going to work. If the restoration fails, the file system may be recoverable by some other process.

In the following example, the mount point is `/sam1`.

    # cd /sam1

2. Use the `samfsrestore` command with the `-T` and `-f` options to restore the entire file system relative to the current directory.

Use the syntax shown in the following example, specifying the path name of the dump file after the `-f` option and the path name of the restore log file after the `-g` option.

You can use the restore log file as input to the `restore.sh`(1M) script to stage back files that were online at the time of the dump.

    # samfsrestore -T -f /dump_sam1/dumps/041126 -g log

##

Recovering a SAM-QFS File System Without a Dump File

You may be able to recover data from a SAM-QFS file system even if you do not have access to output from a `samfsdump`(1M) command, or to an archiver log file.

The following procedure shows you how to re-create user files by reloading tape or optical disk and using the `star`(1M) command's `-n` option.

Note - Recovering file systems from archive cartridges and using the `star` command is a tedious and time-consuming process. This should not be considered the standard procedure for disaster recovery.

### To Recover a File System Without a Dump File

1. (Optional) Disable any automated processes that are related to Sun StorEdge SAM-FS operations.

If any of the following automated processes are running, disable them during the recovery process to ensure that no data is lost:

- Recycling

Disable any recycling activities, including those triggered by an entry in root's `crontab`(4). Failure to disable recycling activity could result the recycling and relabeling of tapes that contain active data.

- Archiving

- Processes that capture `samfsdump`(1M) files.

Suspending these processes saves an existing `samfsdump` output file, and provides an opportunity for easier recovery.

- Writes into the file system

2. (Optional) Disable NFS sharing for the file system.

It can be easier to recover data if the file system is not running NFS sharing on the file systems during the recovery period.

3. Use the `sammkfs`(1M) command to remake the SAM-QFS file system to be restored.

4. Identify the cartridges that contain the archive copy information.

5. Read all the archive media.

If you are using tapes, use the `tar`(1M), `gnutar`(1M), or `star`(1M) command.

6. If recovering from tape media, use the `tarback.sh` script.

The `tarback.sh`(1M) script is located in `/opt/SUNWsamfs/examples/tarback.sh`. This script identifies a single tape drive for use during recovery and provides a list of VSNs to recover. The script uses `star`(1M) to loop through a volume, reading all available archive files.

The `star`(1M) command is an enhanced version of `gnutar`(1M). The `tarback.sh` script uses `star`(1M) and the `-n` option, which restores only files that are newer than the existing copy. If the archive copy that you are about to restore is older than the existing copy, the restore is skipped.

The `tarback.sh`(1M) script is described in Backup and Recovery Commands and Tools. For more information about this script, see the `tarback.sh` man page. See also Unreadable Label With No Other Copies Available for an example of how to use the script.

7. If recovering from magnetic-optical media, contact Sun customer support.

Copyright © 2006, Sun Microsystems, Inc. All Rights Reserved.