1832666 Members
3185 Online
110043 Solutions
New Discussion

CPIO selective restore

 
SOLVED
Go to solution
Peter Hogenes
Advisor

CPIO selective restore

Hello,

A customer of me, made a backup tape with the following command : "find / -print | cpio -ocB > /dev/rmt/0m". Now i want to restore only 2 mountpoints (Dirs) : /opt/oracle/* and /oradb/prod_0102/*
Is this possible with cpio, if yes can someone give te exact command ?.

Thanks, Peter Hogenes
6 REPLIES 6
A. Clay Stephenson
Acclaimed Contributor

Re: CPIO selective restore

cpio -icBvdum < /dev/rmt/0m '/opt/oracle/*' '/oradb/prod_0102'
If it ain't broke, I can fix that.
Peter Hogenes
Advisor

Re: CPIO selective restore

Hi A,

I've started the command, no results yet. I guess it takes a long time to search the files on a DAT72 tape. Let you know monday....
Bill Hassell
Honored Contributor
Solution

Re: CPIO selective restore

Just like tar, pax and dump, the *entire* tape must be read to find the requested files. So the restore time will about be the same time as it took for the backup. Be careful not to kill the restore process when you see the file list staring during the restore--there may be more at another part of the tape or the current file listed is very large. It is impossible to know when a selective file restore has been completed with cpio (or tar, etc).

This is one the most iomportant differences between fbackup (and commercial backup programs) and primitive Unix tools. fbackup knows where the files are located on the tape and uses a high speed search to position the tape.


Bill Hassell, sysadmin
A. Clay Stephenson
Acclaimed Contributor

Re: CPIO selective restore

Ooops, although it was obvious I left of the '*' of your second pattern.

cpio -icBvdum < /dev/rmt/0m '/opt/oracle/*' '/oradb/prod_0102'

should be:

cpio -icBvdum < /dev/rmt/0m '/opt/oracle/*' '/oradb/prod_0102/*'

By the way, it's always a good idea to do a
cpio -icBvt < /dev/rmt/0m first to list the files before actually trying to extract them so that you can see exactly what patterns are there (e.g ./opt as opposed to /opt).

You should also modify your backup procedures to not use absolute pathnames because it is difficult to restore those to alternate locations.

It's much better to
cd /
find . | cpio ...
If it ain't broke, I can fix that.
Peter Hogenes
Advisor

Re: CPIO selective restore

Thanks guys,

It works now. I found out that CPIO is not my favorite backup tool ;-)
But the customer is the boss.

Peter Hogenes
Advisor

Re: CPIO selective restore

Problem solved. See thread