Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
cancel
Showing results for 
Search instead for 
Did you mean: 

Simple tar issue

Doug_3
Frequent Advisor

Simple tar issue

Hello, sorry I am posting such a minor issue, but I need some quick advice. I use fbackup but have some archived tar tapes that I want to extract a file from. My experience with tar is minimal so please be kind (I did check the man and rtfm'ed the manuals we have...)

I use this syntax:
tar -xvf /dev/rmt/0m /path/path/path/file

I get a msg (and no file):
tar tape error (5)

I can extract a listing and the file does exist on the tape.

tia!!!

Doug
8 REPLIES
Jitendra_1
Trusted Contributor

Re: Simple tar issue

Can you post what command you used for tape listing and what was the output. I suspect the tape might have files with relative pathnames like "./path/path/path/file" . Can you try extracting it this way? is the tape device file /dev/rmt/0m for sure?
Learning is the Key!
Doug_3
Frequent Advisor

Re: Simple tar issue

Hermant,

The original command was:
tar -cvf /dev/rmt/0m *

and a second tape was
tar -cvf /dev/rmt/0m path1 path2 path3/path4

My command was

tar -xvf /dev/rmt/0m /path1/filename

is my problem the addition of the absolute path "/" and the syntax SHOULD be

tar -xvf /dev/rmt/0m path/filename

tia

Doug
Jitendra_1
Trusted Contributor

Re: Simple tar issue

You have copied the files using absolute path it seems so you should be ok with your present tar command.
Try tar -tvf /dev/rmt/0m | grep filename . where filename is the file you want .Suppose the output is $filename with all the path appended. After that give
tar -xvf $filename ( $filename is exactly as it shows from above output).

Hope this helps.
Good luck
Learning is the Key!
melvyn burnard
Honored Contributor

Re: Simple tar issue

You might also want to take a look at the pax command as this allows recovering from a tar or cpio archive and even stripping off leading directories.

man pax
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!

Re: Simple tar issue

Try a tape cleaner.
Dan Hetzel
Honored Contributor

Re: Simple tar issue

Hi Doug,

Your problem definitely comes from the absolute/relative path you are using.

In your example above, you use relative path to create the tape and absolute path when trying to retrieve the data.

A simple 'tar tv' will show you how files are stored on the tape, and you should use the name as it is shown to extract your file(s).

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Doug_3
Frequent Advisor

Re: Simple tar issue

Thanks to all who replied. It was a issue of relative vs. absolute path. Different operators were using different paths.

Unforetunately for me the tape did not restore the file that tar -vf was on the tape. No error msg, just no file.

Oh well, back to fbackup which as worked flawlessly for me.

Doug
Doug_3
Frequent Advisor

Re: Simple tar issue

thank you.