Netbackup Manual Tar Recovery

Jason B Consorti

22 December 2000

Updated 22 October 2002

Copyright (c) 2000 Jason B. Consorti

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found at GNU Free Documentation License


  • 1. Make sure that Netbackup is installed or the binaries are available from the Netbackup CD (specifically their commercial copy of a GNU-like tar).
  • 2. Make sure you have a "media contents" report on the tape.
    • 2.1. A complete Media Contents can come from the tape itself with the bpmedialist command
      • 2.1.1. /usr/openv/netbackup/bin/admincmd/bpmedialist -U -mcontents -ev MEDIA_NUMBER
    • 2.2. The real, physical layout of a netbackup tape is as follows
      • 2.2.1. MH * BH Image * BH Image * BH Image * EH *
        • MH is the Media Header
        • * is a tape mark (used for fast forward and rewind)
        • BH is a Backup Header
        • Image is, well, the actual data
        • EH is the Empty Header (used for position validation)
      • 2.3. An Images on Media report is VERY useful. This can only be gotten from the production Netbackup server's data base. It will help you reconstruct full and incremental dumps. Without it, you must do some digging with the Media Contents report.
        • 2.3.1. /usr/openv/netbackup/bin/admincd/bpimmedia -U -mediaid MEDIA_NUMBER
        • 2.3.2. This report is normally printed out at WPG for disaster recovery information and included in offsite storage packages.
  • 3. Load the media
    • 3.1. If we are on a system with Netbackup, you must request the media!
      • 3.1.1. (New for October 2002)It helps to expire the records in the Netbackup Database that match the tape:
        • /usr/openv/netbackup/bin/admincmd/bpexpdate -d 0 -ev MEDIA_NUMBER
      • 3.1.2. /usr/openv/bin/tpreq -ev MEDIA_NUMBER -a r -d 8mm -p POOLNAME -f /tmp/tape
      • 3.1.3. POOLNAME is usually WPGstandard, Offsite, or free (caps count)
      • 3.1.4. /tmp/tape can be any new file name of your choice
    • 3.2. If we are on a stand-alone system with no netbackup installed and the binaries (just /usr/openv/netbackup/bin/tar really) are available, just load the tape.
      • 3.2.1(New for 2002!!!)You MUST refer to the device in the way that it was setup on Netbackup!
      • For example, at WPG we use compressed berkley blocks (as recommended by Veritas). We would refer to a drive as "/dev/rmt/0cbn", meaning, "drive 0, compressed, berkley blocks, no rewind."
  • 4. Rewind the tape:
    • 4.1. /usr/bin/mt -f /tmp/tape rew
  • 5. Choose the file from the media report and fast forward to it
    • 5.1. /usr/bin/mt -f /tmp/tape fsf file_number
    • 5.2. If the file is file number 37, you can fsf 37 to reach it. This will skip the Media Header (which is really the first file on the tape)
    • 5.3. Do NOT go to the IDX or TIR files. They are useless to you.
    • 5.4. (Edited 22 October 2002)Please note that we at WPG set Netbackup to break the backups into files that are less than or equal to 2000 kilobytes in length. A backup may, therefore span several files. Locate the Backup id and Fragment number for clues to locating a complete backup. You MUST use the multi-volume option of tar to extract a backup spanning several files.
  • 6. Move ahead one record (to skip the Backup Header)
      6.1. /usr/bin/mt -f /tmp/tape fsr 1
  • 7. Run Netbackup's tar to list or extract!
    • 7.1. To just list the contents, run with the -t option
      • 7.1.1. /usr/openv/netbackup/bin/tar -t -v -f /tmp/tape -b 512
    • 7.2. To extract the entire contents, without a leading /, use -x
      • 7.2.1. /usr/openv/netbackup/bin/tar -x -v -p -f /tmp/tape -b 512
    • 7.3. To extract a specific directory, without a leading /, specify the target directory (NOTE: you can use gnu's tar instead of Veritas Netbackup's tar; it will work fine):
      • 7.3.1. /usr/openv/netbackup/bin/tar -x -v -p -f /tmp/tape -b 512 DIRECTORY_NAME
    • 7.4. To extract entire contents from multiple fragments, without leading /, use -M (gnu tar won't do this)
      • 7.4.1. /usr/openv/netbackup/bin/tar -x -M -v -p -f /tmp/tape -b 512
      • 7.4.2. Tar will automatically position the tape to the next file, assuming it to be the next volume (or fragment) of the backup. It will prompt you to "Prepare volume #X and hit return:". Just hitting return will continue. If the next fragment is on another tape, then you must rewind the current tape, unmount it, replace with the right tape, fast forward, and fsr to the right file to continue the restore.
    • 7.5. Note that the block size is 256000, so you can pass 512 to tar (actually, it's really 500, but tar figures it out to be 500 anyway)
    • 7.6. When you are doing multiple restores, note that you may have to rewind the tape (/usr/bin/mt -f /tmp/tape rew) and fast forward (/usr/bin/mt -f /tmp/tape fsf #) to get to the next backup. The device is a "No Rewind" device, so that consecutive backups can be accessed by just moving ahead one record (/usr/bin/mt -f /tmp/tape fsr 1) and re-running tar. (Be mindful of multiple-volume backups when searching for the right backup!)
    • 7.7. Netbackup's tar's help can be accessed for additional options (such as NOT stripping the leading /):
      • 7.7.1. /usr/openv/netbackup/bin/tar +help
  • 8. Rewind and Eject the media
    • 8.1. /usr/bin/mt -f /tmp/tape rew
    • 8.2. /usr/openv/volmgr/bin/tpunmount
  • 9. Example:
    • 9.1. I need to restore all of sybprod:/opt2 from an incremental backup done in the early morning of 13 October 2001 (Author's Note: Damn how nearly prophetic was I! Off by merely one month!). A look on the Images on Media report (that was printed for the duplicates done later that morning) tells me that an incremental backup of Sybprod is on tape 190022. It has a title of "sybprod_0973059916" and shows that it consists of an IDX file and 5 fragments. A look on the Media Contents report tells me that fragment 1 of "sybprod_0973059916" is file number 113 and that the other fragments follow consecutively.
    • 9.2. I find my Unix machine with an AIT drive and install the OS. I also mount the Netbackup Server CD and install the software but don't configure anything. I discover that the AIT drive is configured as /dev/rmt/0cb (or /dev/rmt/0n for no rewind).
    • 9.3. I put in tape 190022 into the AIT drive. I rewind the tape for good measure.
      • 9.3.1. /usr/bin/mt -f /dev/rmt/0cb rew
    • 9.4. I fast forward 113 files on the tape
      • 9.4.1. /usr/bin/mt -f /dev/rmt/0cbn fsf 113
    • 9.5. I move over the Backup Header
      • 9.5.1. /usr/bin/mt -f /dev/rmt/0cbn fsr 1
    • 9.6. I change to the root directory and make sure that /opt2 exists and has lots of space.
      • 9.6.1. cd / ; ls -ld opt2 ; df -k /opt2
    • 9.7. I begin the restore (note that I'm using a blocking factor of 500, which produces the same result as 512)
      • 9.7.1. /usr/openv/netbackup/bin/tar -x -M -v -p -f \ /dev/rmt/0cbn -b 500 /opt2
      • 9.7.2. I am prompted 4 different times to hit return and dutifully do so.
    • 9.8. I check everything out to make sure it is ok and celebrate, for I am the hero of the day!

  • I believe it is possible to use gnu's tar for a restore, by just repeatedly running the command to accomodate the "Multi Volume" function of Netbackup's gnu tar (BTW: has anyone seen the GPL mandated source?).
  • I've tested this out many times without fail. Some of my common pitfalls:
    • Not setting /kernel/drv/st.conf to accomodate AIT drives in a DR situation:
      • "SONY SDX-500C", "SONY 8mm AIT2", "SONY_AIT";
      • SONY_AIT = 1,0x34,0,0x9639,4,0x13,0x0,0x8C,0x8C,3;
      • OR SONY_AIT = 1, 0x36, 0, 0xd679, 4, 0x00, 0x00, 0x00, 0x00,0;
    • Screwing up the reference to the tape drive (ie: /dev/rmt/0 instead of /dev/rmt/0cb)
    • Not using Netbackup's hack of gnutar (forget about Sun's Berkely tar).
    • Forgetting to fsr over the Backup Header
    • Not setting the READONLY tab on the tapes and watching in angst as Netbackup overwrites the tape!

Jason At Consorti Dot Com Copyright December 2000