Restoring to a different directory using CPIO

Restoring to a different directory using CPIO

Post by Michael Wals » Fri, 27 Jun 2003 02:45:35



Hi

I am working on some recovery procedures on a AIX system at the moment. The
environment consists of two seperate servers with different file-systems and
mount points.

The source system is backed up regularly using a command along the following
lines

find / -name '*files*' - print | cpio -ocvB > /dev/rmt0

I want to be able restore the files from that tape on the target system but
direct the files into a different directory due to file-system space
constraints.

As the backups are using absolute referencing the cpio -id option is not
viable

The closest I have come to solving the problem is something like

cpio -ircvB "*files needed*" < /dev/rmt0

but the interactive nature of this is undesirable as it is intended as
procedures for an operator which can be kicked off and require no human
interaction, not to mention the risk of typos

Does anybody have a solution for this possibly using celver tricks with
pipes and sed/awk etc. I am out of ideas.

regards

MJW

 
 
 

Restoring to a different directory using CPIO

Post by Uli Lin » Fri, 27 Jun 2003 03:45:47


Quote:

> I am working on some recovery procedures on a AIX system at the moment.
The
> environment consists of two seperate servers with different file-systems
and
> mount points.

> The source system is backed up regularly using a command along the
following
> lines

> find / -name '*files*' - print | cpio -ocvB > /dev/rmt0

> I want to be able restore the files from that tape on the target system
but
> direct the files into a different directory due to file-system space
> constraints.

...

> Does anybody have a solution for this possibly using celver tricks with
> pipes and sed/awk etc. I am out of ideas.

No clever sed/awk, much easier:
use "find . -print | ..." and all files are backed up with relative
filenames to current working dir.
Nothing specific to AIX.

---
Uli

 
 
 

Restoring to a different directory using CPIO

Post by Geoff Clar » Fri, 27 Jun 2003 21:34:07



>> The source system is backed up regularly using a command along the
>following
>> lines

>> find / -name '*files*' - print | cpio -ocvB > /dev/rmt0

>> I want to be able restore the files from that tape on the target system
>but
>> direct the files into a different directory due to file-system space
>> constraints.
>use "find . -print | ..." and all files are backed up with relative
>filenames to current working dir.

That's the right solution when designing a backup methodology, but
if there is a need to restore from a cpio (or tar) tape that has
already been written the "wrong" way, then there is:

cd target_dir
pax -r -pe -s,^/,, < /dev/rmt0

--

 
 
 

Restoring to a different directory using CPIO

Post by Uli Lin » Fri, 27 Jun 2003 23:24:42


Quote:> >> The source system is backed up regularly using a command
> >>  along the following lines

> >> find / -name '*files*' - print | cpio -ocvB > /dev/rmt0

> >> I want to be able restore the files from that tape on the
> >> target system but direct the files into a different
> >>directory due to file-system space constraints.
> >use "find . -print | ..." and all files are backed up with relative
> >filenames to current working dir.

> That's the right solution when designing a backup methodology,
> but if there is a need to restore from a cpio (or tar) tape that has
> already been written the "wrong" way, then there is:

> cd target_dir
> pax -r -pe -s,^/,, < /dev/rmt0

Or use "chroot" as a simple alternative.

---
Uli

 
 
 

Restoring to a different directory using CPIO

Post by Michael Wals » Sat, 28 Jun 2003 02:12:45


Unfortunately this is on a site where I want to restore a backup from a
couple of weeks ago so I am stuck with the absolute paths, and I cant change
the back-up for the future without all the usual change-request paperwork.


Quote:

> > I am working on some recovery procedures on a AIX system at the moment.
> The
> > environment consists of two seperate servers with different file-systems
> and
> > mount points.

> > The source system is backed up regularly using a command along the
> following
> > lines

> > find / -name '*files*' - print | cpio -ocvB > /dev/rmt0

> > I want to be able restore the files from that tape on the target system
> but
> > direct the files into a different directory due to file-system space
> > constraints.

> ...

> > Does anybody have a solution for this possibly using celver tricks with
> > pipes and sed/awk etc. I am out of ideas.

> No clever sed/awk, much easier:
> use "find . -print | ..." and all files are backed up with relative
> filenames to current working dir.
> Nothing specific to AIX.

> ---
> Uli

 
 
 

Restoring to a different directory using CPIO

Post by Michael Wals » Sat, 28 Jun 2003 02:19:13


PAX looks like it might solve my problem

can I selectively restore using a variant of the pax statment you mentioned.

e.g. the backup has files from /fs1 and /fs2 and I would like to skip /fs2 I
was using a filter in the cpio as follows

cpio -ircvB "/fs1/*" </dev/rmt0

how would I include this filtering in pax?

regards

MJW



> >> The source system is backed up regularly using a command along the
> >following
> >> lines

> >> find / -name '*files*' - print | cpio -ocvB > /dev/rmt0

> >> I want to be able restore the files from that tape on the target system
> >but
> >> direct the files into a different directory due to file-system space
> >> constraints.

> >use "find . -print | ..." and all files are backed up with relative
> >filenames to current working dir.

> That's the right solution when designing a backup methodology, but
> if there is a need to restore from a cpio (or tar) tape that has
> already been written the "wrong" way, then there is:

> cd target_dir
> pax -r -pe -s,^/,, < /dev/rmt0

> --


 
 
 

Restoring to a different directory using CPIO

Post by Geoff Clar » Sat, 28 Jun 2003 21:33:33



>PAX looks like it might solve my problem
>can I selectively restore using a variant of the pax statment you mentioned.

Yes, pax accepts pattern arguments the same as cpio does.

Quote:>e.g. the backup has files from /fs1 and /fs2 and I would like to skip /fs2 I
>was using a filter in the cpio as follows
>cpio -ircvB "/fs1/*" </dev/rmt0
>how would I include this filtering in pax?

pax -r -pe -s,^/,, "/fs1/*" < /dev/rmt0

(You could have found this out quicker by reading the pax man page.)

--

 
 
 

Restoring to a different directory using CPIO

Post by Michael Wals » Sat, 28 Jun 2003 23:57:10


Thanks

I am not back at the site until next week but when I get there I will have a
read of the man page and give pax a try out



> >PAX looks like it might solve my problem

> >can I selectively restore using a variant of the pax statment you
mentioned.

> Yes, pax accepts pattern arguments the same as cpio does.

> >e.g. the backup has files from /fs1 and /fs2 and I would like to skip
/fs2 I
> >was using a filter in the cpio as follows

> >cpio -ircvB "/fs1/*" </dev/rmt0

> >how would I include this filtering in pax?

> pax -r -pe -s,^/,, "/fs1/*" < /dev/rmt0

> (You could have found this out quicker by reading the pax man page.)

> --