Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

How to use tar to restore data off of a tape

Updated: 21 May 2009 | 4 comments
Vilobh Meshram's picture
-2 2 Votes
Login to vote

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

Comments

Nathan Kippen's picture
11
Mar
2009
2 Votes -2
Login to vote

LTO3 Corrupt CM

Perhaps you could answer this question ...

LTO3 tapes have cartridge memory, I got a tape alert saying that I have a corrupt tape directory. (Media position error) I read that you just have to re-read all the data on the media to fix the cartridge memory.

Do you know the commands to do this?

Symantec Certified Specialist in Symantec NetBackup 7.0
(NBU 7.1.0.2, ACSLS, DataDomain, NDMP...)
Don't forget to vote or mark solution!

Stumpr's picture
11
Mar
2009
2 Votes -2
Login to vote

origins

I'm not sure who wrote this but there is a strikingly similiar technote

Directions on how to use tar to restore data off of a tape. This example is based on the Solaris Platform.

Last Updated: November 22 2001 12:12 AM

http://seer.support.veritas.com/docs/205940.htm

 

Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige

Pravs's picture
17
Apr
2009
3 Votes +1
Login to vote

Yes, the technote is same.

Yes, the technote is same.

"Just one person saying to me, “You’ve made my day!” makes my day."

CHONG WU's picture
19
Jun
2009
2 Votes -2
Login to vote

For

For /usr/openv/netbackup/bin/tar -xvf /tmp/mytape, this  restore all of files. If  I need to restore one direcotory named /etc/default/kbd, how can use 'tar ' command?