Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Restoring to a different directory using CPIO

0 views
Skip to first unread message

Michael Walsh

unread,
Jun 25, 2003, 1:45:35 PM6/25/03
to
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
nospam-rem...@eircom.net


Uli Link

unread,
Jun 25, 2003, 2:45:47 PM6/25/03
to

>
> 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


Geoff Clare

unread,
Jun 26, 2003, 8:34:07 AM6/26/03
to
"Uli Link" <Ulrich--nO--(dot)-sPAM...@Epost.de> writes:

>> 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

--
Geoff Clare <nos...@gclare.org.uk>

Uli Link

unread,
Jun 26, 2003, 10:24:42 AM6/26/03
to

> >> 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


Michael Walsh

unread,
Jun 26, 2003, 1:12:45 PM6/26/03
to
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.


"Uli Link" <Ulrich--nO--(dot)-sPAM...@Epost.de> wrote in message
news:bdcqkt$jmr$04$1...@news.t-online.com...

Michael Walsh

unread,
Jun 26, 2003, 1:19:13 PM6/26/03
to
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


"Geoff Clare" <ge...@clare.See-My-Signature.invalid> wrote in message
news:hh39k...@clare.See-My-Signature.invalid...

Geoff Clare

unread,
Jun 27, 2003, 8:33:33 AM6/27/03
to
"Michael Walsh" <mjw...@eircom.net> writes:

>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.)

--
Geoff Clare <nos...@gclare.org.uk>

Michael Walsh

unread,
Jun 27, 2003, 10:57:10 AM6/27/03
to
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

"Geoff Clare" <ge...@clare.See-My-Signature.invalid> wrote in message

news:hh547...@clare.See-My-Signature.invalid...

0 new messages