Operating System - HP-UX
1753964 Members
7505 Online
108811 Solutions
New Discussion юеВ

restore single file from make_net_recovery

 
SOLVED
Go to solution
Steve Coates
Frequent Advisor

restore single file from make_net_recovery

Is there a way I can restore a single file from the make_net_recovery file?
2 REPLIES 2
Patrick Wallek
Honored Contributor
Solution

Re: restore single file from make_net_recovery

Yes, there is.

# gzcat archive_file_name | tar -xvf - dir/file_to_restore

If you want to see a list of files in the archive do:

# gzcat archive_file_name | tar -tvf -
John P. Kole
Frequent Advisor

Re: restore single file from make_net_recovery

> Date: Jan 20, 2005 17:56:39 GMT
> From: Steve Coates
> Subj: restore single file from make_net_recovery
>
> Is there a way I can restore a single file
> from the make_net_recovery file?

You can use a command like:

# gzcat archive_name | tar -xvf - dir/file_to_restore

As long as the archive is not larger than 2,147,483,647 bytes.
But once your archives have crossed this 2-gigabyte boundary,
the gzcat utility will not work. See these ITRC articles for more details:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=713940
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=753165

For archive larger than 2-gigabytes, one must use something like:

# cat archive_name | gunzip | tar -xvf - dir/file_to_restore


On a side note, sometimes I want to extract a file from an archive,
and at the same time, have the extracted file renamed (like to be
sure I am not overwriting a real system file). I accomplish this
using pax's rename feature as follows:

$ oldname=etc/hosts
$ newname=/tmp/foobar
$ archive=OSarch.gz
$ cat ${archive} | gunzip | pax -s,${oldname},${newname}, -rvf - ${oldname}
USTAR format archive
/tmp/foobar

At this point, the file "/tmp/foobar" is my "etc/hosts" file from
the archive:

$ head -4 /tmp/foobar
# @(#)B11.23_LRhosts $Revision: 1.9.214.1 $ $Date: 96/10/08 13:20:01 $
#
# The form for each entry is:
#

Regards,
jpkole
What could possibly go wrong?