cancel
Showing results for 
Search instead for 
Did you mean: 

How to use tar to restore data off of a tape

Vilobh_Meshram
Not applicable

Note:  This is not a recommended procedure.  It should be used only in extreme situations and as a last step in attempting to restore data. This procedure has been used on numerous occasions with success.

First, figure out the fragment number and the block size needed.

Ex:

# ./bpmedialist -mcontents -ev D0004
media id = D0004, allocated 09/21/99 14:19:, retention level = 1

File number 1
 Backup id = jeckle_0937941543
 Creation date = 09/21/99 14:19:
 Expiration date = 10/05/99 14:19:
 Retention level = 1
 Copy number = 1
 Fragment number = 1
 Block size (in bytes) = 32768

Then work the tape:

ficus# tpreq -ev D0004 -a r -d dlt -p NetBackup -f /tmp/mytape

This issues a tpreq for media id D0004, the " r " is for read, the " -d " is density, " -p " is pool and " -f " is mount point.


ficus# /usr/openv/volmgr/bin/vmoprcmd -d   (to verify the media is mounted)

                               PENDING REQUESTS

                                    <NONE>

                                 DRIVE STATUS

Drv Type   Control  User      Label  RVSN    EVSN    Ready   Wr.Enbl. ReqId
0 dlt      TLD                -                     No       -        -         1 dlt      TLD    root       Yes   D0004   D0004    Yes     Yes       0
2 dlt      AVR               Yes   D0004            Yes     Yes       -

                            ADDITIONAL DRIVE STATUS

Drv DriveName            Multihost Assigned        Comment
 0 Drive0                No       -
 1 Drive1                No       ficus
 2 Drive2                No       -
ficus#

ficus# tpconfig -d   (to get the device file name for commands):

Index DriveName         DrivePath          Type   Multihost Status
***** *********              **********             ****   ********* ******
0   Drive0                 /dev/rmt/0cbn           dlt      No        UP
       TLD(0) Definition       DRIVE=1
1   Drive1                 /dev/rmt/1cbn            dlt      No        UP
       TLD(0) Definition       DRIVE=2
2   Drive2                 /dev/rmt/1lbn             dlt      No        UP

Currently defined robotics are:
 TLD(0)     robotic path = /dev/sg/c0t6l0, volume database host = ficus

Standalone drive volume database host = saturn

ficus# mt -f /tmp/mytape rew (goes to beginning of tape)

ficus# mt -f /tmp/mytape stat (verify at beginning of tape)

Vendor 'QUANTUM ' Product 'DLT7000        ' tape drive:
  sense key(0x0)= No Additional Sense   residual= 0   retries= 0
  file no= 0   block no= 0

ficus# mt -f /tmp/mytape fsf (position to file #1)

ficus# mt -f /tmp/mytape stat (verify)
Vendor 'QUANTUM ' Product 'DLT7000        ' tape drive:
  sense key(0x0)= No Additional Sense   residual= 0   retries= 0
  file no= 1   block no= 0

ficus# mt -f /tmp/mytape fsr (position to record 1)

ficus# mt -f /tmp/mytape stat (verify)
Vendor 'QUANTUM ' Product 'DLT7000        ' tape drive:
  sense key(0x0)= No Additional Sense   residual= 0   retries= 0
  file no= 1   block no= 1


ficus# /usr/openv/netbackup/bin/tar -tvf /tmp/mytape  (run tar command)
Blocksize = 2 records
Hmm, this doesn't look like a tar archive.
Skipping to next file header...

Since the tar command didn't work in the above scenario, run the stat command to see what file the
tape is positioned at:
ficus# mt -f /tmp/mytape stat
Vendor 'QUANTUM ' Product 'DLT7000        ' tape drive:
  sense key(0x0)= No Additional Sense   residual= 0   retries= 0
  file no= 1   block no= 2

ficus# /usr/openv/netbackup/bin/tar -tvf /tmp/mytape
Blocksize = 126 records
Hmm, this doesn't look like a tar archive.
Skipping to next file header...

drwxr-xr-x root/other  Jul 27 09:51 1999 /
drwxr-xr-x root/sys    Jul 27 07:36 1999 /etc/
drwxrwxr-x root/sys    Mar  8 14:27 1999 /etc/default/
-r--r--r-- root/sys  Oct 30 16:58 1996 /etc/default/sys-suspend
-r-xr-xr-x bin/bin    Mar  5 12:45 1999 /etc/default/cron
-r--r--r-- bin/bin    Mar  5 12:45 1999 /etc/default/fs
-r--r--r-- root/sys  Mar  5 12:45 1999 /etc/default/inetinit
-r--r--r-- root/sys  Mar  5 12:45 1999 /etc/default/kbd
-r--r--r-- root/sys   Mar  5 12:45 1999 /etc/default/passwd
-r--r--r-- root/sys  Mar  5 12:45 1999 /etc/default/tar

To get the information off of the tape execute:
/usr/openv/netbackup/bin/tar -xvf /tmp/mytape -b <BYTESIZE/512>

In this example <BYTESIZE/512> is 32768 / 512, which equals 64.

The following will move the data from one host to another host:

Run this at the target host (client). In the below example tape_host is the server with the tape mounted.

rsh tape_host dd if=/tmp/mytape bs=<BLOCKSIZE> | /usr/openv/netbackup/bin/tar -xvf - -b <BYTESIZE/512>

In this example <BLOCKSIZE> equals 32768 and <BYTESIZE/512> equals 64.

To unmount the media run /usr/openv/volmgr/bin/tpunmount /tmp/mytape

 

Thanks,

Vilobh