Operating System - HP-UX
1834163 Members
2641 Online
110064 Solutions
New Discussion

Retoring files from tape in UNIX HP-UX 11

 
SOLVED
Go to solution
Teck Sim
Frequent Advisor

Retoring files from tape in UNIX HP-UX 11

How do I restore missing files from a backup tape in UNIX.
Can anybody please give me the steps to restore them.

Thanks in advance.
13 REPLIES 13
Helen French
Honored Contributor
Solution

Re: Retoring files from tape in UNIX HP-UX 11

It depends on the backup utility you 've used when backing up your data. For eg: if you used tar -cvf for backup, then:

# tar -xvf /dev/rmt/0m - will restore the data.
Life is a promise, fulfill it!
Uday_S_Ankolekar
Honored Contributor

Re: Retoring files from tape in UNIX HP-UX 11


Well,

It depends on How did you take backup,

tar is one of the most common utility.

tar -xvf device name would restore file.

But there are many other ways to backup and restore.

fbackup/frecover, ftio, cpio, dd are few of them
Let forum knwo how you took backup first.

-USA..
Good Luck..
James R. Ferguson
Acclaimed Contributor

Re: Retoring files from tape in UNIX HP-UX 11

Hi Teck:

As already indicated, you first need to specify the backup utility used ('tar', 'cpio', 'fbackup', etc.).

Having said that, since SAM uses 'fbackup', to recover a file from one of its tapes, you use 'frecover'.

For example:

# /usr/sbin/frecover ???mov ???f /dev/rmt/0m ???x ???i /etc/hosts

This would recover the /etc/hosts file.

Regards!

...JRF...
Teck Sim
Frequent Advisor

Re: Retoring files from tape in UNIX HP-UX 11

I lost about 10 files from /opt/webmastr/openorders/flow/, so how exactly I can restore these 10 files to /tmp from a backup tape.
Thanks.
Helen French
Honored Contributor

Re: Retoring files from tape in UNIX HP-UX 11

Difficult to answer unless you specify HOW YOU DID THE BACKUP ? which command did you use to take the backup ?
Life is a promise, fulfill it!
Santosh Nair_1
Honored Contributor

Re: Retoring files from tape in UNIX HP-UX 11

As already mentioned before, the way to restore the file depends on the how the file(s) were backed up in the first place. If you're trying to restore from an ignite tape, just remember that ignite basically uses tar. The only caveat is to skip the Ignite header on the tape by doing a mt fsf 1 on the /dev/rmt/0mn device (note the n at the end which signifies a no-rewind device).

-Santosh
Life is what's happening while you're busy making other plans
MANOJ SRIVASTAVA
Honored Contributor

Re: Retoring files from tape in UNIX HP-UX 11

Hi Teck


Try using tar tvf /dev/rmt/0m and look at the contents of the tape , if you see the file you want then may be you can restore it baack .

Also if you have used the absolute path then I woul suggest you to move the present direcorty to some other name as restoring the files would overwrite the exisiting files too.

tar xvf /dev/rmt/0m is to restore the files fromt eh tape.

Do a man tar to know waht you want to .

Manoj Srivastava
Teck Sim
Frequent Advisor

Re: Retoring files from tape in UNIX HP-UX 11

We use TAR.
Pete Randall
Outstanding Contributor

Re: Retoring files from tape in UNIX HP-UX 11

Then do a tar -xvf.

Pete
Helen French
Honored Contributor

Re: Retoring files from tape in UNIX HP-UX 11

If you 've used tar, then there are two possiblities:

1) Absolute path - when taking backups, if you 've used absolute path ( starting from root - /opt/appl), then while restoring it will put the files in original location.

2) Relative path - when taking backup if you have used relative path ( starting from current directory - ./opt/appl), then you can first change the directory to the destination, then restore the file to the current one.

This is the command:

# tar -xvf device_name

eg:
# cd /tmp
# tar -xvf /dev/rmt/0m
Life is a promise, fulfill it!
Santosh Nair_1
Honored Contributor

Re: Retoring files from tape in UNIX HP-UX 11

Actually if you do a tar xvf /dev/rmt/0m, it will restore ALL the files in the tape archive. If all you have is the contents of /tmp, then you're good to go. If you want to restore specific files from the archive, then you can specify the files to be restored...i.e.:

tar xvf /dev/rmt/0mn file1 file2 ... etc.

Also, you might want to do a tar tvf /dev/rmt/0m which will give you a table of contents for the archive...so you can see what's in the archive before you try to restore files.

Hope this helps.

-Santosh
Life is what's happening while you're busy making other plans
John Palmer
Honored Contributor

Re: Retoring files from tape in UNIX HP-UX 11

More specifically, if you only want to restore specific files (or directories) you use:

tar -xf ...

where filename is exactly the same name as tar reports when you run tar -tvf .

The name will depend as others stated on whether or not you used full or relative pathnames when you wrote the tar tape but something like:
tar -tvf | grep openorders/flow
should tell you what you should supply as to the tar -xf command.

Regards,
John
Helen French
Honored Contributor

Re: Retoring files from tape in UNIX HP-UX 11

Incase if you 've used absolute path while taking backup, then for restoring files to current directory use 'pax' command.

# man pax (for details)

Also see this thread and find Patrick's answer for a better explanation on this:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x835a50011d20d6118ff40090279cd0f9,00.html
Life is a promise, fulfill it!