1820177 Members
4217 Online
109620 Solutions
New Discussion юеВ

Re: File(s) Recovery

 
SOLVED
Go to solution
Roger Lavender
Frequent Advisor

File(s) Recovery

The default format for an Ignite tape is tar.

The man page for make_tape_recovery gives an example of locating and extracting a single file from the recovery archive:

mt -t /dev/rmt/0mn fsf 1
tar -xvf /dev/rmt/0mn [filename]

Question:

If needed to extract a complete directory, can the [filename] be a directory path or wildcard. For Example:

tar -xvf /dev/rmt/0mn /var/adm/sw
or
tar -xvf /dev/rmt/0mn /var/adm/sw/*

Thanks in advance for any assistance.
16 REPLIES 16
Dennis Handly
Acclaimed Contributor
Solution

Re: File(s) Recovery

>The default format for an Ignite tape is tar.

Or possibly pax(1).

>can the filename be a directory path or wildcard.

Yes. No wildcards, unless you use pax(1) and you would have to quote the pattern, unless you are happy with filename completion.

>tar -xvf /dev/rmt/0mn /var/adm/sw

You'll probably have to leave out the leading "/".
Also, for Integrity, the fsf value is 22.
James R. Ferguson
Acclaimed Contributor

Re: File(s) Recovery

Hi Roger:

Either will work. Without the wildcard, the directory and its contents will be extracted. With the wildcard, only the contents will be loaded. Should the directory on the *server* be absent, this would fail. Hence, use the form without a wildcard.

Regards!

...JRF...
Roger Lavender
Frequent Advisor

Re: File(s) Recovery

[quote]
You'll probably have to leave out the leading "/".
Also, for Integrity, the fsf value is 22.
[/quote]

??? Why would I leave out the leading "/" in a directory path?

??? What is significance of "22"? Yes, This is for 'Integrity' server.
Dennis Handly
Acclaimed Contributor

Re: File(s) Recovery

>Why would I leave out the leading "/" in a directory path?

Because ignite is being kind and using a format that allows you to restore the file elsewhere, with tar. Before you waste time trying to restore a file, try just listing the tape.

>What is significance of 22? This is for Integrity server.

A magic number for Integrity, same as 1 is for PA.
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1396648
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1401212
Roger Lavender
Frequent Advisor

Re: File(s) Recovery

OK...learn something new everyday!

Using the examples above, ran:

mt -t /dev/rmt/0mn fsf 22
tar -tvf /dev/rmt/0mn | grep sw

That worked ok, so tape 'is' accessible'. Interesting that preceding "/" is omitted in the listing....

So, if I was going to restore the '/var/adm/sw' directory in this example, then cmd would be:

tar -xvf /dev/rmt/0mn var/adm/sw

...run from the root file system?

James R. Ferguson
Acclaimed Contributor

Re: File(s) Recovery

Hi (again) Roger:

I need to clarify my response to your original question asking if the filename(s) can be a directory or a directory with a wildcard.

You *might* or you *might not* obtain the results you are looking for if you use the '/path/*' notation in lieu of the '/path'.

The problem is that the shell normally does filename expansion. Thus, something like this:

# mkdir /var/tmp/DUMMYDIR
# cd /var/tmp/DUMMYDIR
# touch f1 f2 f3
# ls
f1 f2 f3
# cd .. && tar -cvf /var/tmp/myarchive.tar ./DUMMYDIR
a ./DUMMYDIR/f1 0 blocks
a ./DUMMYDIR/f2 0 blocks
a ./DUMMYDIR/f3 0 blocks

# rm DUMMYDIR/f1 DUMMYDIR/f2

...this leaves only 'f3' in 'DUMMYDIR'...

Now, compare:

# tar -xvf /var/tmp/myarchive.tar ./DUMMYDIR/*
x ./DUMMYDIR/f3, 0 bytes, 0 tape blocks

...which only restores what's already present in the directory; with:

# tar -xvf /var/tmp/myarchive.tar ./DUMMYDIR
x ./DUMMYDIR/f1, 0 bytes, 0 tape blocks
x ./DUMMYDIR/f2, 0 bytes, 0 tape blocks
x ./DUMMYDIR/f3, 0 bytes, 0 tape blocks

...which restores everything that was archived.

The reason is that the shell is normally optioned ('set +f') to expand filenames. Hence, in the test above:

# tar -xvf /var/tmp/myarchive.tar ./DUMMYDIR/*

...really looked like:

# echo tar -xvf /var/tmp/myarchive.tar ./DUMMYDIR/*
tar -xvf /var/tmp/myarchive.tar ./DUMMYDIR/f3

If you disabled filename expansion, nothing would be restored if you used the "*" as in these examples:

# set -f
# tar -xvf /var/tmp/myarchive.tar ./DUMMYDIR/*
#

Regards!

...JRF...
Roger Lavender
Frequent Advisor

Re: File(s) Recovery

Thanks James....

OK, as a test, I loaded one of my Ignite tapes, created a "/var/tmp/roger", changed to that location, then ran some commands:

THIS WORKED:

fndev1-> mt -f /dev/rmt/0mn rew
fndev1-> mt -f /dev/rmt/0mn fsf 22
fndev1-> tar -tvf /dev/rmt/0mn | grep sw


THESE DID NOT WORK:

fndev1-> mt -f /dev/rmt/0mn rew
fndev1-> mt -f /dev/rmt/0mn fsf 22
fndev1-> tar -xvf /dev/rmt/0mn var/adm/sw/*

fndev1-> mt -f /dev/rmt/0mn rew
fndev1-> mt -f /dev/rmt/0mn fsf 22
fndev1-> tar -xvf /dev/rmt/0mn /var/adm/sw/*

fndev1-> mt -f /dev/rmt/0mn rew
fndev1-> mt -f /dev/rmt/0mn fsf 22
fndev1-> tar -xvf /dev/rmt/0mn var/adm/sw

fndev1-> mt -f /dev/rmt/0mn rew
fndev1-> mt -f /dev/rmt/0mn fsf 22
fndev1-> tar -xvf /dev/rmt/0mn /var/adm/sw
Patrick Wallek
Honored Contributor

Re: File(s) Recovery

>>fndev1-> mt -f /dev/rmt/0mn rew
>.fndev1-> mt -f /dev/rmt/0mn fsf 22
>>fndev1-> tar -xvf /dev/rmt/0mn var/adm/sw

This should have worked.

Your first list of statements, with the 'tar -tvf' is just listing the contents of the tape. I assume you saw "var/adm/sw" in your output?

Did you get any messages when you tried extracting?
Roger Lavender
Frequent Advisor

Re: File(s) Recovery

Your first list of statements, with the 'tar -tvf' is just listing the contents of the tape. I assume you saw "var/adm/sw" in your output?

Yes, "var/adm/sw" was in the list along with all the asscoiated subdirs and files. This was just done to see if the tape could in fact be read - a sort of sanity check.

Did you get any messages when you tried extracting?

Nope, and thats what concerned me. It 'should' have extracted the files, yet didn't, and didn't say why it didn't - no error code or warning. I have no way of interpreting what the problem is.
Dennis Handly
Acclaimed Contributor

Re: File(s) Recovery

>JRF: If you disabled filename expansion, nothing would be restored if you used the "*" as in these examples:
# set -f
# tar -xvf /var/tmp/myarchive.tar ./DUMMYDIR/*

If you used pax, it would work.

>Patrick: tar -xvf /dev/rmt/0mn var/adm/sw
>This should have worked.

Right. If you see a path with -tvf, you should be able to use this to restore.
Roger Lavender
Frequent Advisor

Re: File(s) Recovery

Ok, I repeated the same steps as previoously done with minor exception.

As a test:

>I tarred the existing '/var/adm/sw' directory to safe storage.

>Changed to the "/" directory

>executed the commands:

mt -f /dev/rmt/0mn rew
mt -f /dev/rmt/0mn fsf 22
tar -xvf /dev/rmt/0mn var/ad/sw

This worked. The only thing I can think of at this point is that the restore has to be relative to the root directory and not a temporary directory somewhere else on the server.

I may test this a few more times to make sure of the behavior. Fairly certain that that if the process is the same, I can script this out or future use with little or no problem.

Thanks all.


Patrick Wallek
Honored Contributor

Re: File(s) Recovery

>>The only thing I can think of at this point
>>is that the restore has to be relative to
>>the root directory and not a temporary
>>directory somewhere else on the server.

No, tar really doesn't care, nor does it matter, where you start the restore from. It should work the same whether you start from '/' or from '/fred/flintstone'.
Roger Lavender
Frequent Advisor

Re: File(s) Recovery

Well, I know it shouldn't matter. But, when tried from within '/var/roger', it failed - no response, no error or warning codes, messages, etc - nada. When tried from the root file system, it worked.

I'm open to any explainations at this point.......meanwhile, I'll test some more.
Dennis Handly
Acclaimed Contributor

Re: File(s) Recovery

>I'm open to any explanations at this point.

Why don't you toss tar and go with pax(1), perhaps better messages?
cd /var/roger
# fiddle with mt(1) position as above
pax -r -v -f /dev/rmt/0mn var/adm/sw

Should we ask why you are fiddling with trying to restore the IPD in /var/adm/sw/?
Roger Lavender
Frequent Advisor

Re: File(s) Recovery

Thanks for the advise on pax. I'll consider it.

Sure, you can ask. I just picked a directory. There was nothing special about using '/var/adm/sw'. I'm a twiddler, and I always wanted a way to extract the files from an Ignite tape as a part of my toolset in case of any future failure(s). I just like to be prepared.

Thanks again to all for the insight and assistance.

Roger Lavender
Frequent Advisor

Re: File(s) Recovery

Solved