Restoring Files and Directories

Version 1

    Restoring Files and Directories

    This page describes how to restore individual files and directories.

     

    https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
    If the mv(1) command has been used to move an archived file to a different directory, the file is not rearchived. If you use the star(1M) command to recover a moved file, the star(1M) header on the archive media retains the original path name. When you use the star(1M) command to reload the file, the file is restored to its original location.
    You can see the path by issuing the star(1M) command with its tvbf arguments. Then, you can extract the file to its original location by issuing the star(1M) command again. Finally, issue the mv(1) command to move the file to its new directory.

     

    Restoring Regular Files and Directories With samfsdump(1M) Output

    You can use either of the following procedures to restore Sun StorageTek SAM or SAM-QFS files and directories that were archived to tape or magneto-optical cartridges. These procedures use the dump file created by samfsdump(1M).

    Beginning with SAM-QFS Manager version 2.1, compressed metadata snapshots created by SAM-QFS Manager can be indexed without being uncompressed. In order to take advantage of this feature, you should select the gzip compression method for any scheduled metadata snapshots.

    If you have existing compressed snapshots that are not in the gzip format, you can use the gznew command to convert them to gzip format.

    In addition, indexing for metadata snapshots was also improved in version 2.1 of SAM-QFS Manager. Additional information was added to the index, including information about damaged or online files. To take advantage of this improvement, you should delete any existing indexes and recreate them.

    How to Restore Files Using SAM-QFS Manager

    1. From the Servers page, click the name of the server that contains the file system that you want.
      The File Systems Summary page is displayed.
    2. Navigate to the File Browsing & Recovery node in the navigation tree.
      The File Browser page is displayed.
    3. Use the file system mount point down menu to choose the file system you want to restore.
      A set of radio buttons displays on the top right corner of the table: Live Data and Recovery Point.
      https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
      If you do not see these radio buttons, the selected recovery point has not been indexed. You must index the recovery point on the Recovery Points page before you can browse the recovery point file within the File Browser.

    4. Select the Recovery Point radio button and choose a date of the recovery point you want to restore.
      The contents of the selected recovery point are displayed.
    5. Locate the file you want to restore by browsing within the File Browser.
    6. Select Restore from the Operations drop-down menu.
      The Restore window is displayed.
    7. Specify the location to which you want to restore the file or directory.
      By default, the location is the path of the original file or directory, relative to the mount point of the file system. You can specify a different path relative to the mount point, or you can specify an absolute path on any archiving file system.
    8. From the Online Status After Restoring drop-down menu, choose the actions that you want the file system to take after completing the restore process.
    9. Click Submit.

    How to Restore Files Using a samfsdump(1M) File

    The example in this procedure uses the samfsrestore(1M) command to restore the lost file /sam1/mary/mary1 from a samfsdump metadata dump file called /dump_sam1/041126. In the example, a temporary restoration directory called restore is created in the /sam1 file system.

    1. Use the mkdir(1) command to create the directory to which you want to restore the files within a SAM-QFS file system.

       

      {{#}} {{*mkdir restore*}}

       

    2. Use the archive(1) command with the -r and -n options to prevent the archiver from archiving from this temporary directory location.

       

      # archive -r -n restore

       

    3. Use the cd(1) command to change to the temporary restoration directory.

       

      # cd restore

       

    4. Use the samfsrestore(1M) command with the -t and -f options to list the contents of the dump file. After the -f option specify the dump file’s path name, as shown in the following example.

       

      # samfsrestore -t -f /dump_sam1/041126samfsrestore -t -f /dump_sam1/041126./lost+found ./neptune ./mary ./fileA ./fileB ./fileC ./fileD ./fileE ./mary/mary1 ./mary/mary2 ./neptune/vmcore.0./neptune/unix.0./neptune/bounds

       

    5. Search the listing from the previous step to verify that the lost file is in the dump file.
      If you find the file you are looking for, copy down the exact path name shown in the output to use in the following step.
      In the previous screen example, the lost file, called mary1, is shown as residing in the ./mary directory.
    6. Use the samfsrestore (1m) command with the -T and -f options to restore the file’s inode information to the current directory.
      The file name you specify must match exactly the path name as it was listed in the previous output. The following example shows the use of samfsrestore to retrieve the file ./mary/mary1 from the dump file /dump_sam1/041126.

       

      # samfsrestore -T -f /dump_sam1/041126 ./mary/mary1

       

    7. Use the sls(1) command with the -D option to list detailed information about the file, and verify that the inode information for the correct file has been retrieved.
      The following example shows inode information for file ./mary/mary1.

       

      # sls -D ./mary/mary1 mary/mary1: mode: -rw-rw---- links: 1 owner: mary group: sam length: 53 inode: 43offline; archdone; copy 1: ---- Nov 17 12:35 8ae.1 xt 000000copy 2: ---- Nov 17 15:51 cd3.7f57 xt 000000access: Nov 17 12:33 modification: Nov 17 12:33changed: Nov 17 12:33 attributes: Nov 17 15:49creation: Nov 17 12:33 residence: Nov 17 15:52

       

    8. Use the mv(1) command to move the file to the desired location.

       

      # cd mary # mv mary1 /sam1/mary/

       

    Restoring Files and Directories Without samfsdump(1M) Output

    The following table lists the procedures used to restore various types of files when no samfsdump(1M) output is available.

    Restoring Files When No sampfdump(1M) Output Is Available
    Type of FileConditionWhere Described
    Regular file archived to removable media cartridgesAn archiver log file exists with an entry for the file, or you have output from the sls command with the -D option that lists the file.Restoring a Regular File Using Archiver Log or sls Information
    Regular file archived to removable media cartridgesNo archiver log file exists.Restoring a Regular File Without Information From an Archiver Log
    Regular file archived to diskAn archiver log file exists with an entry for the file, or you have output from the sls command with the -D option that lists the file.Restoring Files Archived to Disk
    Segmented fileAn archiver log file exists with entries for the file.Restoring a Segmented File Using Information From an Archiver Log
    Volume overflow fileAn archiver log file exists with entries for the file.Restoring a Volume Overflow File Using Information From an Archiver Log

    When you have an archiver log with one or more entries for a missing file, see the following sections for how to interpret the information in the archiver log file and how to determine which of the above procedures to use:

    Determining the File Type

    This section shows how to determine from a missing file’s archiver log file entries whether the file is a regular file, a segmented file, or a volume overflow file. You need this information to decide which of the restoration procedures to follow from Restoring Files and Directories Without samfsdump(1M) Output.

    Regular File

    Each regular file has a single entry in an archiver log. In field 12 of the archiver log entry, a regular file is identified with an f. The following example shows a typical archiver log entry for a regular file:

    A 96/01/05 10:55:56 mo v1 set_1.1 d2e.1 samfs2 770.11 2673 test/file3 _f_ 0 0

    Segmented File

    A segmented file is a file that has the segment attribute set and a segment size specified through the segment(1) command. When a file has the segment attribute set, it is archived and staged in segment-sized chunks. The segment size is shown in field 10 of the archiver log file in kilobytes.Each segmented file has multiple entries in an archiver log. Example 5-1 shows three entries for segmented file seg/aaa. Field 12 has a S indicating that the file type is file segment.

    Example 5-1 Archiver Log Entry for a Segmented File
    A 2000/06/15 17:07:28 ib E00000 all.1 1276a.1 samfs4 14.5 10485760 seg/aaa/1 _S_ 0 51A 2000/06/15 17:07:29 ib E00000 all.1 1276a.5002 samfs4 15.5 10485760 seg/aaa/2 _S_ 0 51A 2000/06/15 17:07:29 ib E00000 all.1 1276a.a003 samfs4 16.5 184 seg/aaa/3 _S_ 0 51

    Volume Overflow File

    A volume overflow file is a file that is written on multiple volumes. A volume overflow file has multiple entries in an archiver log, one for each section of the file. Example 5-2 shows two entries for the two sections of the regular file big2d. Field 5 shows that the file starts on VSN CFX600 and overflows to VSN CFX603, and field 13 shows the section numbers, 0 and 1.

    Example 5-2 Archiver Log Entry for a Volume Overflow File
    A 2001/10/31 09:47:29 lt _CFX600_ arset1.1 3668e.1 samfs9 71950.152011823616 testdir1/big2d f _0_ 43A 2001/10/31 09:47:29 lt _CFX603_ arset1.1 3844a.0 samfs9 71950.151209402048 testdir1/big2d f _1_ 41

    Restoring a Regular File Using Archiver Log or sls Information

    The following table shows the information you need from the archiver log or sls -D command output in order to restore a regular file.

    Information Needed for Restoring a Regular File
    DefinitionField in Archiver Log OutputField in Archive Copy Line in sls -D Output
    Media type45
    Volume serial name (VSN)56
    Position74

    If you can obtain the needed information about a regular file either from its archiver log entry or from output from the sls(1) command with the -D option, you can restore the file with the request(1M) and star(1M) commands. As shown in the examples that follow, you use the request command first to create a file whose contents represent the contents of one or more pieces of removable media. This new file is sometimes referred to as a request file. You then use the star command to extract the file.

    How to Restore a Regular File Using Information From an Archiver Log or sls Command Output

    https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
    For this procedure to work, the SAM-QFS file system must be mounted.
    1. Log in as, or switch user to, root.
    2. Find and record the media type, the file’s position, and the VSN.
    3. If you have an archiver log, use cat(1M) or another command to search the archiver log file for an entry for the missing file.
      The following example shows a sample entry for a file archived on a tape followed by a sample entry for a file archived on an optical disk.
      # cat ... A 96/06/04 10:55:56 lt DLT001 arset0.1 286.1324f samfs1 770.11130543 tape_test/file4 0 0 0A 96/01/05 10:55:56 mo v1 set_1.1 d2e.1 samfs2 770.11 2673test/file3 0 0 0
      For definitions of the relevant fields in the archiver log file, see Information Needed for Restoring a Regular File.
    4. If you have output from the sls command with the -D option about the missing file, search that output. The following example shows output from this command for file tape_test/file4.
      # sls -D /sam1/tape_test/file4 /sam1/tape_test/file4: mode: -rw-rw---- links: 1 owner: root group: other length: 130543offline; copy 1: Jun 4 10:55 286.1324f lt DLT001 access: May 24 16:55 modification: May 24 16:38changed: May 24 16:38 attributes: Jun 4 10:55creation: May 24 16:38 residence: Jun 4 10:55
    5. Record the media type, the file’s position, and the VSN to use as input to the request(1M) command in the next step.
    6. Use the request(1M) command with the -p option, followed by the hexadecimal 0x and the position number from the archiver log to position to the beginning of the tar(1) header for the file.
      https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
      VSNs specified with the request(1M) command must reside on a local automated library.

      The following example creates a request file with the contents of the archive containing the example file from step 2a that is on tape:
      # request -p 0x286 -m lt -v DLT001 /sam1/xxxx
      The following example creates a request file with the contents of the example file from step 2a that is on optical disk:
      # request -p 0xd2e -m mo -v v1 /sam2/xxxx
    7. Use the star(1M) command to extract the files.
      The star(1M) command restores all the files from the archive file that you are pointing to with the request file.
      If you labeled the tape with a block size other than the default (16 kilobytes), you would use the block size in bytes divided by 512 (in place of the value 32) for the star command’s -b option. You can see the tape block size by mounting the tape and observing either the samu(1M) utility’s t display, the samu utility’s vdisplay (press CTRL-i for detail lines), or the output of the dump_cat(1M) command.
      # cd /sam1 # star -xv -b 32 -f /sam1/xxxx ... tape_test/file4 ... tar: directory checksum error # cd /sam2 # star -xv -b 32 -f /sam2/xxxx ... test/file3 ... tar: directory checksum error #
      https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
      You can ignore the directory checksum error.

    8. Use the sls(1) command to verify that you have extracted the lost file.
      The following example shows the command output for the file on the optical disk.
      #sls -D /sam2/test/file3 /sam2/test/file3: mode: -rw-rw---- links: 1 owner: root group: other length: 2673 admin id: 7 inode: 161.2copy 1:---- May 1 15:41 286.1324f mo v1 access: May 1 16:50 modification: May 1 15:41changed: May 1 15:40 attributes: May 1 15:44creation: May 1 15:40 residence: May 1 16:50

    Restoring a Regular File Without Information From an Archiver Log

    If you do not have an archive log available with an entry for a regular file, you can still restore the file using either an automated library or a manually mounted, stand-alone drive, under the following conditions:

    • If you are using an automated library, the automated library daemon is active on the system.
    • If you are using a manually mounted, stand-alone drive, /kernel/drv/st.conf is correctly configured for the tape drive that you are using. For more information about performing this task, see how to add tape support to the st.conf file in the Sun StorageTek Storage Archive Manager Installation and Upgrade Guide.

    How to Restore a Regular File Without Information From an Archiver Log

    https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
    If the only resources available consist of a cartridge containing archive copies and a Solaris system without SAM-QFS software installed, start this procedure with Step 3
    1. If you are using an automated library, prevent the SAM-QFS software from using the tape drive.
      https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
      If you are using a manually mounted, stand-alone drive, skip this step.
      You can use the samu(1M) command with the :unavail eq option, the samcmd(1M) command with the unavail eq option, the devicetool(1M) commands, or the libmgr(1M) command. For the samu and samcmd commands, specify the Equipment Number of the drive as eq. The Equipment Number for each device is specified in the mcf file.
      The following example shows the use of the samcmd command.
      # samcmd unavail 51
    2. If you are using an automated library, use the samload(1M) command to load the desired volume into the drive.
      https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
      If you are using a manually mounted, stand-alone drive, skip this step.
      For the command-line options to use, see the samload(1) man page. The following example shows the use of the samload command to load the cartridge that is in slot 3 of library 50 into the drive with Equipment Number 51.
      # samload 50:03 51
    3. Use the mt(1M) command to rewind the tape.
      The following example shows this command applied to tape drive /dev/rmt/2.
      # mt -f /dev/rmt/2cbn rewind
      https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
      Because the device name used in these examples ends with the n (no rewind) option, each of the commands in the following steps examines the next file on the tape.
    4. Use od(1M) or another command to examine the ANSI label on the cartridge, and find the line that starts with 0000240.
      The first file on the cartridge is the ANSI label. In the following example, the information you are looking for appears on the line that starts with 0000240.
      # od -c /dev/rmt/2cbn 0000000 V O L 1 X X X 0000020 S A M - F S 10000040 . 000000600000100 40000120 H D R 10000140 0 0 0 1 00000160 0 0 1 0 0 0 1 0 0 2 4 9 0 90000200 S A M - 0000220 F S 1 . 00000240 H D R 2 1 6 3 8 4 10000260 2 0 g 0310000300* 0000360
    5. Note the five characters that appear after H D R 2 on the line that starts 0000240.
      These five characters are the bottom five digits of the block size, in decimal. In the previous screen example, the characters are 1 6 3 8 4.
    6. Use the bottom five digits to determine the block size used on the media.
      The following table shows the block sizes corresponding to these digits for the dd(1M) and tar(1) commands.
      Bottom Five Digits of Block SizeBlock Size for dd(1)512-byte Blocks for tar(1) and star(1M)
      1638416 kilobytes32 blocks
      3276832 kilobytes64 blocks
      6553664 kilobytes128 blocks
      31072128 kilobytes256 blocks
      62144256 kilobytes512 blocks
      24288512 kilobytes1024 blocks
      485761024 kilobytes2048 blocks
      971522048 kilobytes4096 blocks
    7. Issue one of the following commands:
      • If the star(1M) command is available, use it to find the file in the archive.
        Issue it with the number of 512-byte blocks obtained in the previous two steps.
        You can download the star command from a Sun StorageTek SAM system onto any Solaris system.
        https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
        star files have an extended maximum file size of 1 terabytes-1. tar and star files have compatible formats only at file sizes less than or equal to 8 gigabytes-1. At file sizes larger than 8 gigabytes, the formats of star and tar files are not compatible. Therefore, you must use the starcommand to read archives larger than 8 gigabytes-1.

        The following code example shows the star command being used to examine the first tar file. The block size for both the star(1M) and tar(1) commands is specified in units of 512-byte blocks. The number 32 used after -b in the example is the number of 512-byte blocks that corresponds to the number 16384 in the ANSI label in Step 4, from the table in Step 6.
        # star -tv -b 32 -f /dev/rmt/2cbn -rw-rw---- 0/1 102564 Sep 6 13:02 1996 test 6+1 records in 11+1 records out
        The following code example shows the same command used to examine the next tar(1) file.
        # star -tv -b 32 -f /dev/rmt/2cbn -rw-rw---- 0/1 102564 Sep 6 13:02 1996 test 6+1 records in 11+1 records out
        The following code example shows two copies of another file being examined.
        # star -tv -b 32 -f /dev/rmt/2cbn -rw-rw---- 0/1 102564 Sep 6 13:02 1996 test2 6+1 records in 11+1 records out # star -tv -b 32 -f /dev/rmt/2cbn -rw-rw---- 0/1 102564 Sep 6 13:02 1996 test2 6+1 records in 11+1 records out
        The following code example shows that the end of the tape has been reached.
        # star -tv -b 32 -f /dev/rmt/2cbn 0+0 records in 0+0 records out tar: blocksize = 0# mt -f /dev/rmt/2cbn status Other tape drive: sense key(0x13)= EOT residual= 0 retries= 0file no= 5 block no= 0
      • If the star(1M) command is not available, use the dd(1M) and tar(1) commands to examine the archives.
        The following code example shows the dd command being used to examine the first tar file. The value 16k used for the input block size (ibs=) is the number in Step 6 that corresponds to the number 16384 in the ANSI label.
        # dd if=/dev/rmt/2cbn ibs=16k obs=10k conv=sync | tar tvf - -rw-rw---- 0/1 102564 Sep 6 13:02 1996 test 6+1 records in 11+1 records out
        The following code example shows the same command examining the next tar(1) file.
        # dd if=/dev/rmt/2cbn ibs=16k obs=10k conv=sync | tar tvf - -rw-rw---- 0/1 102564 Sep 6 13:02 1996 test 6+1 records in 11+1 records out
        The following code example shows the examination of two copies of another file.
        # dd if=/dev/rmt/2cbn ibs=16k obs=10k conv=sync | tar tvf - -rw-rw---- 0/1 102564 Sep 6 13:02 1996 test2 6+1 records in 11+1 records out # dd if=/dev/rmt/2cbn ibs=16k obs=10k conv=sync | tar tvf - -rw-rw---- 0/1 102564 Sep 6 13:02 1996 test2 6+1 records in 11+1 records out
        The following code example shows that the end of the tape has been reached.
        # dd if=/dev/rmt/2cbn ibs=16k obs=10k conv=sync | tar tvf - 0+0 records in 0+0 records out tar: blocksize = 0# mt -f /dev/rmt/2cbn status Other tape drive: sense key(0x13)= EOT residual= 0 retries= 0file no= 5 block no= 0
        https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
        You might receive errors during this process. The following error indicates that the block size you selected does not match that of the tape:{{read: not enough space}}If you receive this error, correct the block size and try again.
    8. When you find the missing file in an archive, extract the file by using either the -x option with the star command or the dd command with the tar command.
      The following code example shows these commands.
      https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
      You can ignore the dd: read error in the first line of dd command output.
      # dd if=/dev/samst/c0t1u0 bs=1k iseek=3374 of=/tmp/junk count=10dd: read error: I/O error 8+0 records in 8+0 records out # tar xvf /tmp/junk # star -xv -f /tmp/junk tar: blocksize = 1-rw-rw---- 0/1 2673 May 1 15:41 1996 dir3/dir2/file0 -rw-rw---- 0/1 946 May 1 15:41 1996 dir3/dir1/file1 -rw-rw---- 0/1 468 May 1 15:41 1996 dir1/dir3/file0

    Restoring a Segmented File Using Information From an Archiver Log

    When a segmented file is archived or staged, it is archived and staged in chunks. Each segmented file has multiple entries in an archiver log.If you can find entries for a missing segmented file in an archiver log, you can use the file’s position, segment size, VSN, and media type to restore the file with the request(1M) and star(1M) commands.

    https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
    In the following procedures, all segments are in the same tape tar(1) file, and no segment is overflowed. If your file has segments on more than one tar(1) file, you must use a separate request(1M) command for each tar(1) file position. If any segments are volume overflow files, use the procedure described in Restoring a Volume Overflow File Using Information From an Archiver Log for those segments.

    How to Restore a Segmented File Using Information From Archiver Log Entries

    https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
    You must have free space in the file system equal to two times the size of the file to be recovered.
    1. Find the archiver log entries for the segmented file by the file system name (from field 8) and file name (from field 11).
      The following code example shows entries for segmented file file2 in the archiver.log file.
      A 2002/11/19 14:01:47 ib E00000 all.1 1276a.1 _samfs4_ 14.5 10485760 _seg/aaa/1_ S 0 51A 2002/11/19 14:04:11 ib E00000 all.1 1276a.5002 _samfs4_ 15.5 10485760 _seg/aaa/2_ S 0 51A 2002/11/19 14:06:24 ib E00000 all.1 1933a.1 _samfs4_ 16.5 184 _seg/aaa/3_ S 0 51
      The code example above shows the archiver log file for file segments in file system samfs4. Each segment has its own entry and file name: seg/aaa/1, seg/aaa/2, and seg/aaa/3.
    2. Do the following for each segment or group of segments that is located at a unique position, even if they are on the same VSN.
      If there are segments on different VSNs, make sure that you specify the correct media type and VSN for each.
    3. Note the contents of fields in the archiver log.
      You will use information from the archiver log as input to the request(1M) command in Step 3 and to the segment(1) command in Step 9. The information you need is contained in the following fields:
      • Field 4. Media type on which the file is stored. For the supported media types, see the mcf(4) man page.
      • Field 5. VSN.
      • Field 7. File position. From the position indicator portion to the left of the period (.) in the field.
      • Field 10. Segment size. This is the length field.
        The first line in the previous screen example provides the following information:
      • The media type is ib.
      • The VSN is E00000.
      • The file’s position is 1276a.
      • The segment size is 10485760.
    4. Issue the request (1M) command to create a removable media file that points to the segments.
    5. request -m media-type -p 0x position-number -v VSN filename
      https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
      VSNs specified in the request(1M) command must reside on a local automated library.
      For example, the following command uses the values from the example lines in Step 1:
      # request -m ib -p 0x1276a -v E00000 /sam3/rmfile
      The preceding command retrieves the first two segments.
    6. Issue the star(1M) command.
      Use the name of the file created in the previous step to read the segments from tape onto the disk, as shown in the following example.
      # star xvbf 512 /sam3/rmfile seg/aaa/1seg/aaa/2
    7. stet(1) command to change into the directory where the segmented files reside.
      The following example shows segmented files 1, 2, and 3 in the seg/aaa directory.
      # cd seg # pwd /sam3/seg # ls– l total 8drwxrwx--- 2 root other 4096 Jun 15 17:10 aaa/ # ls -l aaa total 40968-rw-rw---- 1 root other 10485760 Jun 15 17:06 1-rw-rw---- 1 root other 10485760 Jun 15 17:06 2-rw-rw---- 1 root other 184 Jun 15 17:07 3# pwd /sam3/seg # cd aaa # pwd /sam3/seg/aaa
    8. Use the ls(1) and sort(1) commands to list and sort the numbered files in numerical order, and use the cat(1M) command to join the files.
      The temporary file created in this step is not segmented.
      # ls | sort -n | xargs cat > ../bbb
    9. Use the cd(1) command to change to the directory above where the numbered files reside, and then use the rm(1) command to remove the numbered files.
      # cd .. # pwd /sam3/seg # ls– l total 41000drwxrwx--- 2 root other 4096 Jun 15 17:10 aaa/ -rw-rw---- 1 root other 20971704 Jun 15 17:11 bbb # ls -l aaa total 40968-rw-rw---- 1 root other 10485760 Jun 15 17:06 1-rw-rw---- 1 root other 10485760 Jun 15 17:06 2-rw-rw---- 1 root other 184 Jun 15 17:07 3# rm -rf aaa
    10. Use the touch(1M) command to create an empty file.
      # touch aaa
    11. Use the segment(1) command to set the segment attribute on the file that you just created.
      # _segment -l_ _segment-length_ _m_ _filename_
      where:
      • segment-length is the length of the segment in megabytes.
      • filename is the name of the file that you just created.
        To obtain the segment length, take the segment size from field 10 of the archiver log file entry and divide it by 1048576. For example, the segment size in the archiver log entry example in Step a is 10485760. Dividing the segment size by 1048576 yields 10 megabytes, which is entered as 10m in the following example.
        # segment -l 10m aaa
    12. Copy the temporary file created in Step 4 into the empty file created in Step 9, and then remove the temporary file, as shown in the following example.
      # cp bbb aaa # rm bbb
    13. Issue the sls(1) command with the -2K option to list the segments of the segmented file in two lines of output.
      # sls -2K aaa -rw-rw---- 1 root other 20971704 Jun 15 17:12 aaa ---------- ----- sI {3,0,0,0} -rw-rw---- 1 root other 10485760 Jun 15 17:12 aaa/1---------- ----- sS -rw-rw---- 1 root other 10485760 Jun 15 17:12 aaa/2---------- ----- sS -rw-rw---- 1 root other 184 Jun 15 17:12 aaa/3---------- ----- sS

    Restoring a Volume Overflow File Using Information From an Archiver Log

    A volume overflow file is a file that is written on multiple volumes. If you can find entries for a missing volume overflow file in an archiver log, you can use the file’s position, segment size, VSN, and media type to restore and reassemble the file with the request(1M), star(1M), dd(1M), and cat(1) commands.

    How to Restore a Volume Overflow File Using Information From an Archiver Log

    https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
    Free space must be available in the file system equal to two times the size of the file to be recovered.
    1. Use vi(1M) or another command to examine the archiver log file that contains an entry for the file you are trying to recover.
      The following code example shows the archiver log file for file3, a sample volume overflow file.
      A 2004/08/23 10:28:51 sg 700036 ReleasePercent.1 12d55.1 qfs2 11731.1 89128448 ReleasePercent/huge2/dir24/file3 f 0 210A 2004/08/23 10:28:51 sg 700034 ReleasePercent.1 15f9e.0 qfs2 11731.1 525271552 ReleasePercent/huge2/dir24/file3 f 1 220
      The file is identified as a volume overflow file with two sections because the f in the third-to-last field indicates that the entry is for a regular file, and the 0 and the 1 in the second-to-last fields are section numbers. The fifth field shows that the file starts on VSN 700036 and overflows to information about 700034.
    2. Use the request(1M) command to create a removable media file that points to each section of the volume overflow file, as shown in the following example.
      # request -p 0x12d55 -m sg -v 700036 /samfs1/tp1 # request -p 0x15f9e -m sg -v 700032 /samfs1/tp2
    3. Use the cd(1M) and dd(1M) commands to recover the sections.
      Repeat the dd(1M) command for each remaining section.
      In the following example, a block size of 256 kilobytes is assumed for both tapes.
      # cd /qfs2 # dd if=/samfs1/tp1 of=file3.0 ibs=256k 340+0 records in 174080+0 records out # dd if=/samfs1/tp2 of=file3.1 ibs=256k 2004+0 records in 1026048+0 records out
    4. Use the ls(1M) command to examine the output and ensure that all pieces of the file are on the disk.
      # ls -l file3.* -rw-r--r-- 1 root other 89128960 Aug 31 12:07 file3.0-rw-r--r-- 1 root other 525336576 Aug 31 12:14 file3.1
    5. Use the cat(1M) and star(1M) commands to reassemble the file.
      # cat file3.0 file3.1 > file3.2# ls -l file3.* -rw-r--r-- 1 root other 89128960 Aug 31 12:07 file3.0-rw-r--r-- 1 root other 525336576 Aug 31 12:14 file3.1-rw-r--r-- 1 root other 614465536 Aug 31 12:21 file3.2# _star xvbf 256 file3.2_ ReleasePercent/huge2/dir24/file3 # _sls -D ReleasePercent/huge2/dir24/file3_ ReleasePercent/huge2/dir24/file3: mode: -rw-r--r-- links: 1 owner: root group: other length: 614400000 admin id: 0 inode: 12481.1access: Aug 31 12:40 modification: Aug 20 14:28changed: Aug 31 12:43 attributes: Aug 31 12:40creation: Aug 31 12:40 residence: Aug 31 12:40

    Restoring Files Archived to Disk

    The following sections tell you how to gather necessary information and then restore files archived to disk.

    How to Gather Information for a Disk Archive Restoration

    Before You Begin

    You must have the following information before you can restore any files that have been archived to disk:

    • The disk volume name
    • The path to the disk archive tar(1) file
    • The path name defined for the disk volume name in the diskvols.conf file

    You must have either the saved sls(1) output or the archiver log files that include the files you want to restore.

    Steps
    1. Find the disk volume name and the path to the disk archive tar(1) file that contains the archived file.
      You can use either the sls(1) command with the -D option or the archiver log file entry.
      • You can use the sls method if you have sls(1) output for the files you want to restore.
        Examine the lines that correspond to the disk archive copies, indicated by a media type of dk in the fifth field. The second-to-the-last field in these lines shows the disk volume name as defined in the diskvols.conf file. The last field shows the path to the disk archive tar(1) file.
        In the following example, both the commands you type in and the information you are looking for are in bold text.
        # _sls -D filea fileb filec_ filea: mode: -rw-r--r-- links: 1 owner: root group: other length: 65732 admin id: 0 inode: 120235.783archdone; copy 1: ---- Nov 3 14:46 81366.1 dk _DISK_01_ _d8/d19/f102_ copy 2: ---- Nov 3 14:54 2ec7e.209 dk _DISK_02_ _d2/d236/f126_ copy 3: ---- Nov 3 14:58 bf.209 dk _DISK_03_ _f191_ copy 4: ---- Nov 3 15:05 ea7a.209 lt 000064access: Nov 3 14:35 modification: Nov 3 14:35changed: Nov 3 14:35 attributes: Nov 3 14:35creation: Nov 3 14:35 residence: Nov 3 14:35fileb: mode: -rw-r--r-- links: 1 owner: root group: other length: 65732 admin id: 0 inode: 120300.783archdone; copy 1: ---- Nov 3 14:46 81366.105 dk _DISK_01_ _d8/d19/f102_ copy 2: ---- Nov 3 14:54 2ec7e.411 dk _DISK_02_ _d2/d236/f126_ copy 3: ---- Nov 3 14:58 bf.411 dk _DISK_03_ _f191_ copy 4: ---- Nov 3 15:05 ea7a.411 lt 000064access: Nov 3 14:35 modification: Nov 3 14:35changed: Nov 3 14:35 attributes: Nov 3 14:35creation: Nov 3 14:35 residence: Nov 3 14:35. . .
      • You can use the archiver log method if you have an archiver log file that includes the files you want to restore.
        Examine the lines corresponding to the disk archive copies, indicated by a media type of dk in the fourth field. The fifth field in these lines shows the disk volume name as defined in diskvols.conf, and a slash (/) character, and then the path to the disk archive tar(1) file.
        In the following example, the information you are looking for is in bold text.
        A 2003/11/03 14:46:35 dk _DISK_01/d8/d19/f102_ arset4.1 81366.1 shareqfs2 120235.783 65732 testdir4/filea f 0 0A 2003/11/03 14:46:35 dk _DISK_01/d8/d19/f102_ arset4.1 81366.83 shareqfs2 120243.783 65732 testdir4/filec f 0 0A 2003/11/03 14:46:35 dk _DISK_01/d8/d19/f102_ arset4.1 81366.105 shareqfs2 120300.783 65732 testdir4/fileb f 0 0A 2003/11/03 14:50:35 dk _DISK_01/d8/d19/f103_ arset4.1 81367.3 shareqfs2 120228.783 131420A 2003/11/03 14:54:35 dk _DISK_02/d2/d236/f126_ arset4.2 2ec7e.38f shareqfs2 120243.783 65732 testdir4/filec f 0 0A 2003/11/03 14:54:35 dk _DISK_02/d2/d236/f126_ arset4.2 2ec7e.411 shareqfs2 120300.783 65732 testdir4/fileb f 0 0A 2003/11/03 14:58:35 dk _DISK_03/f191_ arset4.3 bf.3 shareqfs2 120228.783 131420. . .
    2. Use cat(1) or another command to examine the diskvols.conf file and to find the path name defined for the disk volume name in diskvols.conf.
      In the following example, two of the three disk volumes defined for receiving disk archive copies are mounted locally, and one is mounted remotely, on server mars.
      # cat /etc/opt/SUNWsamfs/diskvols.conf DISK_01 /ufs2/disk_archive/01DISK_02 /ufs2/disk_archive/02DISK_03 mars:/qfs1/disk_archive/03

    How to Restore Files From a Disk Archive tar(1) File

    Before you start this procedure, collect the information described in Restoring Files Archived to Disk.

    1. Use the mkdir(1) command to create the directory in which you will restore the files.
    2. Use the cd(1) command to change to the restoration directory.
    3. Use the star(1M) command with its -tv option to list the content of the disk archive tar(1) file.
      The following example shows the content of the disk archive tar(1) file associated with archive copy 1.
      # star -tv -f /ufs2/disk_archive/01/d8/d19/f102 -rw-r--r-- root/other 65732 2003-11-03 14:35 testdir4/filea -rw-r--r-- root/other 65732 2003-11-03 14:35 testdir4/filec -rw-r--r-- root/other 65732 2003-11-03 14:35 testdir4/fileb
      https://wikis.oracle.com/images/icons/emoticons/information.gifNote -
      If the tar file is on a remote server, accessing it requires proper configuration of the remote authentication database. For information on configuring the /.rhosts file, see the hosts.equiv(4) man page.

    4. Verify that the files that you want to restore are listed in the output from Step 3.
      If you are restoring a single file but do not know its exact path name, use this information in the next step.
    5. Use the star(1M) command with its -xv option to restore the files.
      The following example shows how the star(1M) command is used to retrieve the single file testdir4/fileb from disk archive tar(1) file /ufs2/disk_archive/01/d8/d19/f102.
      # star -xv -f /ufs2/disk_archive/01/d8/d19/f102 testdir4/fileb testdir4/fileb
      In the following example, the star(1M) command is used to retrieve all files from disk archive tar(1) file /ufs2/disk_archive/01/d8/d19/f102.
      # star -xv -f /ufs2/disk_archive/01/d8/d19/f102 testdir4/filea testdir4/filec testdir4/fileb
    6. Use the sls(1) command with its -DR option to verify that you have extracted the proper files.
      The following example shows multiple retrieved files.
      # sls -DR testdir4: mode: drwxr-xr-x links: 2 owner: root group: other length: 4096 admin id: 0 inode: 120274.789access: Nov 4 14:11 modification: Nov 4 14:11changed: Nov 4 14:11 attributes: Nov 4 14:11creation: Nov 4 14:11 residence: Nov 4 14:11testdir4: testdir4/filea: mode: -rw-r--r-- links: 1 owner: root group: other length: 65732 admin id: 0 inode: 120293.787access: Nov 4 14:11 modification: Nov 3 14:35changed: Nov 4 14:11 attributes: Nov 4 14:11creation: Nov 4 14:11 residence: Nov 4 14:11 testdir4/fileb: mode: -rw-r--r-- links: 1 owner: root group: other length: 65732 admin id: 0 inode: 120281.783access: Nov 4 14:11 modification: Nov 3 14:35changed: Nov 4 14:11 attributes: Nov 4 14:11creation: Nov 4 14:11 residence: Nov 4 14:11 testdir4/filec: mode: -rw-r--r-- links: 1 owner: root group: other length: 65732 admin id: 0 inode: 120280.783access: Nov 4 14:11 modification: Nov 3 14:35changed: Nov 4 14:11 attributes: Nov 4 14:11creation: Nov 4 14:11 residence: Nov 4 14:11

    Retrieving Unarchived Files From File Systems

    Unarchived files that resided within a SAM-QFS file system might not be recoverable after a system outage. The following list contains information that might help you to retrieve unarchived files:

    • You can use the sfind(1M) command line to identify all files in a file system that are not archived. The following command finds all unarchived files associated with the /sam1 mount point:
      # sfind /sam1 ! -archived
    • If the samfsdump(1M) method was used to dump and back up metadata, the samfsrestore(1M) command identifies files without archive copies and flags them as damaged.
    • Sun StorageTek SAM log files cannot help you determine which files were not archived and were therefore lost between the last archiver run and the system outage. However, you can determine the files that might not have been archived by analyzing the archiver.cmd file for archiving directives and intervals. If all files are eligible for archiving, you can find the age of the oldest unarchived (lost) files in the archiver.cmd file’s contents.
    • You can use the -l and -v options with the archiver(1M) command to determine whether volumes were available to archive each archive set’s data before the outage. Lack of sufficient volumes can prevent archiving of data in one or more archive sets. For information about the archiver(1M) command, see thesam-archiverd(1M) man page.
    • If you are recovering files directly from a backup tape in tar(1) format, the files are restored to their locations according to the information on the tape. The path name is relative to the mount point of the file system. If any files have been moved within the system since the archive copies were created, they are restored to their original locations, not to their new locations.