recover.sh - Recovers files archived after last
samfsdump(1M) was taken
The recover.sh script recovers files using the information
in the archiver log. This script can be useful in a
disaster recovery situation when a file system has been lost
and is recovered from a saved samfsdump(1M) file. If files
were archived for the first time after the dump was taken,
there is no record of them in the dump. This script can be
used to reload those files from the archive copy by using
the star(1M) program.
Step 1. Edit the archiver log file and extract the
In this editing session, you should eliminate
entries for second, third, or fourth archive
copies from this file because otherwise the files
are recovered multiple times, which wastes time.
You should also eliminate directory entries.
Directory entries are noted by a d in field 12 of
the archiver log.
After the file is edited, save the edited file to
a temporary file. For example, save this file to
Step 2. Copy the script from its default location to a
Use a command such as the following to copy the
script to a temporary location:
server# cp /opt/SUNWsamfs/examples/recover.sh /tmp/recover.sh
Step 3. Edit a working copy of the script and modify it
for your site.
Edit the copy and change the value of BLK_SIZE
from 128 to the block size in kilobytes for the
VSNs in question.
Step 4. Run the recover.sh script.
This creates a new script to actually do the work
of recovering the files. In the following
example, the SAM-QFS mount point is /sam1.
server# /tmp/recover.sh /sam1 < /tmp/arlog.in > /tmp/recover.out
If you have multiple drives and want to recover
from more than one VSN at a time, you can split
this script into pieces first. The following line
appears at the end of the work for each VSN:
"# ----------- end of files for vsn " XXX " ----
The XXX is replaced with the VSN's bar code label.
Step 5. Create a temporary directory to which the
recovered files can be written.
Create this directory in a SAM-QFS file system.
Although this could be your mount point, it is
probably better to recover to a temporary
directory in the SAM-QFS file system first, and
then move the files to their final location after
recovery is complete and everything looks as
expected. For example:
server# mkdir /sam1/recover
Step 6. Change to the temporary directory to receive the
Use the cd(1) command to change to the directory
in which you want the files recovered.
server# cd /sam1/recover
server# sh -x /tmp/recover.out
Step 7. Run the recover.out script.
The /tmp/recover.out shell script is created in
the previous step. It can be used to recover all
the files listed in the /tmp/arlog.in file.
Run the recover.out script. If you have split the
scripts, you may have to run it multiple times.
Improper use of this script can damage user or system data.
Please refer to the Disaster Planning and Recovery Guide or
contact technical support before using this script.
If used with the SAM-Remote clients or server, the recovery
must be performed on the server to which the tape library is
Do not run multiple recovery scripts at the same time.
This script resides in the following location:
archiver(1M), request(1M), star(1M).