C H A P T E R  6

Salvaging Damaged Volumes

This chapter describes how to restore data from tapes or magneto-optical disks that are not usable in a SAM-QFS environment. This procedures in this chapter describe what to do when a volume is partially corrupted, was accidentally relabeled, has a destroyed label, or is entirely destroyed. The procedures in this chapter describe how to recover data both when archive copies are available and when there are no other copies available.



Note - Before attempting the procedures in this chapter, use software other than Sun StorageTek SAM tools to determine whether the volume can be read. Try reading the volume in multiple drives, or try using the tar(1) command.



This chapter contains the following sections:


Recovering Data From a Tape Volume

The procedures for recovering data from a tape volume vary, depending on the nature of the damage and whether additional archive copies of the volume's files are present on another tape. This section describes how to recover data in the following circumstances:

Damaged Tape Volume With Other Copies Available

The Sun StorageTek SAM software allows you to create up to four archive copies of each online file. By default, only one copy is made, but you should make at least two copies to physically different archive media.

When an alternative archive copy is available, the recovery procedure includes a step for rearchiving all archive copies currently stored on the damaged volume before dispensing with the damaged volume. The new archive copies are made from the alternative archive copy.


procedure icon  To Recycle a Damaged Tape With Other Copies Available

Use this procedure if alternative archive copies exist on volumes that are stored on site and are available for staging.

1. Export the damaged volume from the tape library, and flag it as unavailable in the historian catalog.

Issue the export(1M) and chmed(1M) commands as shown in the following example, specifying the media type (mt) and volume serial number (vsn) of the damaged volume.


# export mt.vsn
# chmed +U mt.vsn

2. Flag the unavailable volume for recycling.

Use the chmed(1M) command, and specify the media type (mt) and the VSN (vsn) of the damaged volume.


# chmed +c mt.vsn

3. Set the -ignore option for the library in the recycler.cmd file.

The following example shows the -ignore option set on the lt20 library:


# vi /etc/opt/SUNWsamfs/recycler.cmd
logfile = /var/adm/recycler.log
lt20 -hwm 75 -mingain 60 -ignore
:wq

For more information about the ignore option, see the recycler-cmd(4) man page.

4. Run the sam-recycler(1M) command with the -x option from the command line.


# sam-recycler -x

When the recycler runs, it does not select any volumes for recycling other than the volume that you have marked as unavailable. The recycler identifies all active archive copies on this volume and flags those archive copies for rearchiving. The next time the archiver runs, the archive copies marked for rearchiving are written to new volumes.

After the archive copies have been written to new volumes, the damaged volume that you are recycling is considered to be drained of active archive copies.

5. Dispense with the volume.

How you dispense with the volume depends on the nature of the damage. Use the following guidelines:



Note - If the tape is either partially corrupt or completely destroyed, do not reuse the tape VSN after the volume has been exported from the historian catalog.



Damaged Tape Volume With No Other Copies Available

If a tape volume is partially corrupt, you may be able to recover data from the parts of the tape volume that are not corrupt. This process is not an exact science, and it requires some trial and error to recover as much data as possible.

Errors logged in the device log can help you determine the area of a tape that is damaged. The archive_audit(1M) command can be used to generate the position and offset information for all archived files for a specific file system. You can use this position and offset information to help determine which archive copies are written to an area of a tape that is damaged.


procedure icon  To Recover Files From a Damaged Tape With No Other Copies Available

1. Use the archive_audit(1M) command to generate a list of all files with archive copies on the partially corrupt tape volume.

Issue the command as shown in the following example, specifying the file system's mount point, the VSN (vsn) of the volume, and an output file name.


# archive_audit /mount-point | grep vsn > filename

2. Edit the output file from the archive_audit(1M) command to remove the lines for the files in the damaged area. Save the list of deleted files for inspection in Step 3.

3. Use the list of files with archive copies that cannot be accessed (the ones that are written in the area of the tape determined to be damaged) to determine whether any of the files are still on the disk.

Files that are not on disk cannot be recovered. You can remove these unrecoverable files from the file system.

4. Edit and run the stageback.sh script on the archive_audit output file you edited in Step 2.

The stageback.sh script can stage each file from archive_audit output, set it to no-release, and mark the file for rearchiving.

For information about the stageback.sh script, see Backup and Recovery Commands and Tools.

a. Open the /opt/SUNWsamfs/examples/stageback.sh file for editing.


# cd /opt/SUNWsamfs/examples
# vi stageback.sh

b. In the section that begins with # echo rearch $file, replace the word media with the media type (mt) and the word VSN with the VSN of the damaged volume, which are the same as the VSNs in Step 1.


# echo rearch $file
#
# Edit the following line for the correct media type and VSN
#
# eval /opt/SUNWsamfs/bin/rearch -m media -v VSN $file

c. Remove the pound sign from the beginning of the lines in the section shown in Step b.

The file should now look like CODE EXAMPLE 6-1.


CODE EXAMPLE 6-1 Example stageback.sh File - Edited
echo rearch $file
# Edit the following line for the correct media type and VSN
eval /opt/SUNWsamfs/bin/rearch -m media -v VSN $file

d. Save and quit the file.

e. Run the stageback.sh script.

Relabeled Tape Volume With No Other Copies Available

The Sun StorageTek SAM software cannot read beyond the end of data (EOD). If a tape is accidentally relabeled, the only possibility for recovering data is to determine whether the tape manufacturer offers a method for reading beyond EOD.

If the tape manufacturer can provide a mechanism for reading beyond EOD, you can recover the data by combining that process with the procedure for recovering files from a tape volume with a label not readable by the Sun StorageTek SAM software. This procedure is described under Unreadable Tape Label With No Other Copies Available.

Unreadable Tape Label With No Other Copies Available

Whenever the Sun StorageTek SAM software receives a request to mount a tape volume in a drive, one of the first actions it takes is to verify the tape label. If the tape label cannot be read, the Sun StorageTek SAM software cannot use the tape for staging or archiving activities.

You can use the tarback.sh script to recover data from a tape with a label that cannot be read. The shell script automates the process of recovering data written to a tape by using the star(1M) command to read each archive file written on a tape volume. The file data is read back onto disk (into a Sun StorageTek QFS or UNIX file system) as data. File data recovered in this manner can then be moved to the appropriate location in the Sun StorageTek QFS file system and archived as new data.


procedure icon  To Recover Files From a Tape Whose Label Is Unreadable

1. If you are using this process to recover file data from several tapes, disable any currently occurring recycling.

When recycling is in process, data on the tape volumes may be inaccessible.

2. Use the cp(1M) command to copy the tarback.sh file to a working location, as shown in the following example.


# cp /opt/SUNWsamfs/examples/tarback.sh /var/tarback.sh

3. Issue the samcmd(1M) command with the unavail option to prevent the tape drive from being used for staging and archiving activities.

Type the Equipment Ordinal value of the drive, as specified in the mcf file. For eq,


# samcmd unavail eq

4. Edit the working copy of the tarback.sh script to specify the variables shown in TABLE 6-1.


TABLE 6-1 Variables to Specify in the tarback.sh Script

Variable

Definition

EQ="eq"

The Equipment Ordinal value of the tape drive as defined in the mcf file.

TAPEDRIVE="path"

The raw path to the device that is described by EQ=.

BLOCKSIZE="size"

The block size, in 512-byte units. Specify 256 for a block size of 128 kilobytes.

MEDIATYPE="mt"

The two-character media type for this tape as defined in the mcf(4) man page.

VSN_LIST="vsn1 vsn2 ..."

The list of VSNs to be read. There is no limit on the number of VSNs that can be specified. Use a space character to separate the VSNs.

You can continue this list on another line by using a backslash (\) character. For example:

VSN_LIST="vsn1 vsn2 \

vsn3"


5. Execute the tarback.sh script.


Recovering Data From a Magneto-optical Volume

The procedures for recovering data from a magneto-optical volume vary, depending on the nature of the damage and whether additional archive copies of the volume's files are present on another tape. This section describes how to recover data in the following circumstances:

See Damaged Magneto-optical Volume With Copies Available.

See Damaged Magneto-optical Volume With No Other Copies Available.

See Relabeled Magneto-optical Volume With No Other Copies Available.

See Unreadable Label With No Other Copies Available.

Damaged Magneto-optical Volume With Copies Available

Regardless of the nature of the damage to the magneto-optical volume, if an alternative archive copy is available, you should use the good magneto-optical volume as your primary set of archive copies.

The recovery procedure includes a step for rearchiving all archive copies currently stored on the damaged volume before dispensing with the damaged volume. The new archive copies are made from the available alternative archive copy.


procedure icon  To Rearchive Files and Recycle a Damaged Magneto-optical Volume With Copies Available

Use this procedure if readable alternative archive copies exist on volumes that are available on-site for staging.

1. Issue the samexport(1M) command to export the damaged volume from the magneto-optical library.

Use the syntax shown in the following example, specifying the media type (mt) and VSN (vsn) of the damaged volume.


# samexport mt.vsn

2. Issue the chmed(1M) command with the -U option to flag the damaged volume as unavailable in the historian catalog.

Specify the media type (mt) and VSN (vsn) of the damaged volume.


# chmed +U mt.vsn

3. Issue unavailable volume for recycling.

Specify the media type (mt) and the VSN (vsn) of the damaged volume.


# chmed +c mt.vsn

4. Edit the recycler.cmd file to set the -ignore option for the library.

The following example shows the -ignore option set on the lt20 library.


# vi /etc/opt/SUNWsamfs/recycler.cmd
logfile = /var/adm/recycler.log
lt20 -hwm 75 -mingain 60 -ignore
:wq

5. Enter the sam-recycler(1M) command with the -x option.


# sam-recycler -x

When the recycler runs, it does not select any volumes for recycling other than the volume that you have marked as unavailable. The recycler identifies all active archive copies on this volume and flags those archive copies for rearchiving. The next time the archiver runs, the archive copies marked for rearchiving are written to new volumes.

After the archive copies have been written to new volumes, the damaged volume that you are recycling is considered to be drained of active archive copies.

6. Dispense with the volume.

How you dispense with the volume depends on the nature of the damage. Use the following guidelines:



Note - If the magneto-optical volume is either partially corrupt or completely destroyed, do not reuse the magneto-optical label after the volume has been exported from the historian catalog.



If the magneto-optical volume is completely destroyed and no alternative archive copies exist, there is no chance for recovering any data from this magneto-optical platter.

Damaged Magneto-optical Volume With No Other Copies Available

If a magneto-optical volume is only partially corrupt, it is possible to recover data written to the parts of the magneto-optical volume that are not damaged. This process requires some trial and error to recover as much data as possible.

It is possible to determine the area of a magnetic optical volume that is damaged from errors logged in the device logs. By using file names for files that cannot be retrieved, you can determine the location of the damage using the position and offset data.

The archive_audit(1M) command audits all archive copies for a specific file system. The output of the archive_audit command includes the position and offset information for each archive copy. You can use this position and offset information to help determine which archive copies are written to an area of a damaged magneto-optical disk.


procedure icon  To Recover From a Damaged Magneto-optical Volume With No Other Copies Available

Copies of files that were archived outside the damaged area on a magneto-optical volume may be accessible. You can use the following procedure to recover files in accessible areas of a partially corrupted magneto-optical volume.

1. Issue the archive_audit(1M) command to generate a list of all files with archive copies on the partially corrupt tape volume.

Use the syntax shown in the following example, specifying the file system's mount point, the VSN of the damaged volume, and an output file name.


# archive_audit /mount-point | grep vsn > filename

2. Edit the archive_audit output file and create three separate files with the following contents:

3. Look for the files with archive copies within the damaged area of the magneto-optical disk to determine whether any of the files are still in disk cache.

Files that are not in disk cache cannot be recovered.

4. Remove the files identified as unrecoverable in Step 2 from the file system.

5. Edit and run the stageback.sh script using the files created in Step 2 that list files outside the damaged area.

The stageback.sh script stages each file from archive_audit output, sets it to no-release, and marks the file for rearchiving.

For information about the stageback.sh script, see Chapter 1.

a. Open the /opt/SUNWsamfs/examples/stageback.sh file for editing.


# cd /opt/SUNWsamfs/examples
# vi stageback.sh

b. In the section that begins with # echo rearch $file replace the word media with the media type and the word VSN with the same VSN specified in Step 1.


# echo rearch $file
#
# Edit the following line for the correct media type and VSN
#
# eval /opt/SUNWsamfs/bin/rearch -m media -v VSN $file

c. Remove the pound sign from the beginning of the lines in the section shown in Step b.


CODE EXAMPLE 6-2 Example stageback.sh File - Edited
echo rearch $file
# Edit the following line for the correct media type and VSN
eval /opt/SUNWsamfs/bin/rearch -m media -v VSN $file

d. Save and quit the file.

e. Run the stageback.sh script.

Relabeled Magneto-optical Volume With No Other Copies Available

Unlike tape media, magneto-optical media do not have an EOD marker. When a magneto-optical volume is accidentally relabeled, the Sun StorageTek SAM software cannot access data written previously. If the label date on the magneto-optical volume is newer than the archive copy date of files, that data is no longer accessible.

Contact Sun Microsystems customer support if a magneto-optical volume is accidentally relabeled. It is sometimes possible to recover some of this data with a special (but unsupported) samst driver that ignores the magneto-optical label date. This driver is not a standard part of the Sun StorageTek SAM product, and it is not released as part of the product. It can only be made available by Sun customer support.

Unreadable Label With No Other Copies Available

For magneto-optical media, there is no standard Solaris approach for locating and skipping to the various tar(1M) files. Contact Sun Microsystems customer support if you need to access files on a magneto-optical volume with an unreadable label.