cancel
Showing results for 
Search instead for 
Did you mean: 

Tar backup on HP-UX

rasn
Occasional Visitor

Tar backup on HP-UX

Hi,

I am unable to extract tar backup from tape drive. Please find the putty output below and suggest:-

# mt -f /dev/rmt/c0t0d0BESTnb status
Drive: HP Ultrium 3-SCSI
Format:
Status: [41114400] BOT online compression immediate-report-mode
File: 0
Block: 0
# tar cvf /dev/rmt/c0t0d0BESTnb /tmp/test
a /tmp/test/docdev.text 1 blocks
a /tmp/test/2swlist_product.txt 1 blocks
a /tmp/test/docdevio.text 35 blocks
a /tmp/test/nickel 156 blocks
a /tmp/test/getsysinfo.sh 44 blocks
a /tmp/test/nickel.docdev.tar.gz 1039 blocks
# mt -f /dev/rmt/c0t0d0BESTnb rewind
# tar tvf /dev/rmt/c0t0d0BESTnb
rwxrwxrwx 0/3 0 Feb 16 13:23 2010 /tmp/test/
rw-rw-rw- 0/3 52 Aug 25 17:04 2009 /tmp/test/docdev.text
rw-rw-rw- 0/3 512 Aug 25 11:30 2009 /tmp/test/2swlist_product.txt
rw-rw-rw- 0/3 17828 Aug 25 17:06 2009 /tmp/test/docdevio.text
rwxr-xr-x 0/3 79452 Jun 6 17:08 2006 /tmp/test/nickel
rwxr-xr-x 0/3 22213 Mar 12 12:22 2009 /tmp/test/getsysinfo.sh
rw-rw-rw- 0/3 531485 Sep 29 12:18 2009 /tmp/test/nickel.docdev.tar.gz
rwxrwxrwx 0/3 0 Feb 16 13:23 2010 /tmp/test/testbk/
# pwd
/tmp/EMC
# mt -f /dev/rmt/c0t0d0BESTnb rewind
# mt -f /dev/rmt/c0t0d0BESTnb status
Drive: HP Ultrium 3-SCSI
Format:
Status: [41114400] BOT online compression immediate-report-mode
File: 0
Block: 0
# pwd
/tmp/EMC
# ll
total 16
drwxr-xr-x 7 root root 8192 Apr 22 2009 emcgrab
# tar xvf /dev/rmt/c0t0d0BESTnb
x /tmp/test/docdev.text, 52 bytes, 1 tape blocks
x /tmp/test/2swlist_product.txt, 512 bytes, 1 tape blocks
x /tmp/test/docdevio.text, 17828 bytes, 35 tape blocks
x /tmp/test/nickel, 79452 bytes, 156 tape blocks
x /tmp/test/getsysinfo.sh, 22213 bytes, 44 tape blocks
x /tmp/test/nickel.docdev.tar.gz, 531485 bytes, 1039 tape blocks
# pwd
/tmp/EMC
# ls
emcgrab
# ll
total 16
drwxr-xr-x 7 root root 8192 Apr 22 2009 emcgrab
7 REPLIES
smatador
Honored Contributor

Re: Tar backup on HP-UX

Hi,
Well, it seem you have extract some files without any problems. You don't have errors so perhaps you have them in
ll /tmp/test/
HTH
rasn
Occasional Visitor

Re: Tar backup on HP-UX

Hi,

Kindly look carefully. There is no any file in pwd and there is "x" sign while extracting files using tar -xvf command.
Sharma Sanjeev
Respected Contributor

Re: Tar backup on HP-UX

Hi rasn

Please provide the absolute path while restoring data

Regards
Sanjeev
Everything is Possible as " IMPOSSIBLE" word itself says I M POSSIBLE
Patrick Wallek
Honored Contributor

Re: Tar backup on HP-UX

Since you 'tar'ed the files with the ABSOLUTE path (tar cvf /tmp/test) they got restored with the SAME path.

The files got restored to the /tmp/test directory. They did NOT get restored to your current directory. That's not how tar works.

Try these commands:

# cd /tmp/test
# tar cvf /dev/rmt/c0t0d0BESTnb .

rewind the tape if you want

do the 'tar tvf' if you want

# cd /tmp/EMC

# tar xvf /dev/rmt/c0t0d0BESTnb

Now check /tmp/EMC and you will probably see files there.
Patrick Wallek
Honored Contributor

Re: Tar backup on HP-UX

By the way, in your output above the 'x' as the first character here:

x /tmp/test/docdev.text, 52 bytes, 1 tape blocks

means that the file was extracted from tape.

If there is an 'a' in the first position it means it was archived to tape.
Steven Schweda
Honored Contributor

Re: Tar backup on HP-UX

> There is no any file in pwd [...]

"pwd" is a command, not a directory.

No files are extracted into your current
working directory because you specified an
absolute path ("/tmp/test") when you created
the archive. Thus, when you extracted the
files in the usual way, "tar" put them where
the paths in the archive told it to put them.
For example:
x /tmp/test/docdev.text

If you would like to extract the files to a
different path, then use a relative path when
you create the archive. For example:

( cd /tmp/test ; tar cf /dev/rmt/c0t0d0BES . )

Notice the difference in the paths in the
archive. ("tar tv" can be useful, too.)

cd /tmp/EMC
mt [...]
tar xfv /dev/rmt/c0t0d0BES

Note that "pax" and GNU "tar" offer options
which would let you override the paths stored
in the archive, but, if you're making the
archive yourself, it's easy to do it so that
any "tar"-like program can extract the files
to any desired destination.


> Please provide the absolute path while
> restoring data

How, exactly, would suggest that one do that?
Dennis Handly
Acclaimed Contributor

Re: Tar backup on HP-UX

> tar cvf /dev/rmt/c0t0d0BESTnb /tmp/test

To get a relative path, you can also use -C directory:
tar -cvf /dev/rmt/c0t0d0BESTnb -C /tmp/test .

>Sharma: Please provide the absolute path while restoring data

>Steven: How would suggest that one do that?

Well, with pax's -s option to rename the file paths. :-)