The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SCO UNIX tape restore canbe842 SCO 5 09-16-2008 08:15 PM
Restore a tape lo-lp-kl AIX 1 06-07-2007 06:22 PM
Backup Tape Restore? bake255 HP-UX 5 08-16-2006 06:56 AM
Restore to disk from tape mtoombs Filesystems, Disks and Memory 1 04-30-2004 11:26 AM
cpio restore - relative pathname sureshy UNIX for Dummies Questions & Answers 4 08-27-2002 06:28 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-23-2006
tayyabq8's Avatar
Moderator
 

Join Date: Nov 2004
Location: Bahrain
Posts: 554
Selective restore from a cpio tape archive

Hi,

I use following command to restore data from my cpio tape archive:

$cpio -icvd < /dev/rct0

But this'll restore all tape contents to the current path, what if I want only selected files from the tape, suppose I want

/home/compdir/home2/Rev83/data/PL/01/*.*

files to be restored from tape archive to my current path only, nothing else, which command I should use to achieve this? Any help would be highly appreciated.

Thnx & Rgrds,
Tayyab
Reply With Quote
Forum Sponsor
  #2  
Old 04-23-2006
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
You can simply specify extraction patterns to cpio, but I prefer to use pax when redirecting a restoration....

You'll have to adjust this to your specific circumstances, but say I have a cpio archive, /var/tmp/tmp.cpio (this could just be your tape device), and I want to restore /home/zb/tmp/*something* to /var/tmp/output... then I'd do...

Code:
pax -r -s ',^/home/zb/tmp/,/var/tmp/output/,' -f /var/tmp/tmp.cpio "*something*"
Substitute /var/tmp/tmp.cpio for your tape device, and adjust the substitution to suit your needs.

If you don't have pax installed, tell us which OS you're using.

And... if you don't actually want to redirect output, just specify the pattern to cpio, something like:
Code:
cpio -icvd "*somepattern*" < input_archive
Cheers
ZB
Reply With Quote
  #3  
Old 04-23-2006
tayyabq8's Avatar
Moderator
 

Join Date: Nov 2004
Location: Bahrain
Posts: 554
Hi,

Thnx for the reply.

I tried pax with following paramters:

Code:
# pax -r -s ',^/home/compdir/home2/Rev83/data/PL/01,/home/temp,' -f /dev/rct0 "*PL*"
UX:pax: WARNING: /dev/rct0 : This doesn't look like a tar archive
UX:pax: WARNING: /dev/rct0 : Skipping to next file...
UX:pax: ERROR: *PL* not found in archive
and I tried:

Code:
#cpio -icvd "home/compdir/home2/Rev83/data/PL/01/*.*" < /dev/rct0
It took long time but nothing happend.

Pls advise.

Rgrds,
Tayyab
Reply With Quote
  #4  
Old 04-23-2006
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
With the cpio command, you probably need to include the leading "/" in the pattern name, otherwise it will not match any files in the archive.

Unfortunately I'm at home at the moment so do not have access to a tape drive to test pax reading from cpio archives stored on tape - on my Linux box at home it can read a cpio archive file ok. Which OS are you using?

EDIT: with the pax command, try something like this
Code:
# pax -r -s ',^/home/compdir/home2/Rev83/data/PL/01,/home/temp,' "*PL*" < /dev/rct0
Cheers
ZB

Last edited by zazzybob; 04-23-2006 at 06:46 AM.
Reply With Quote
  #5  
Old 04-23-2006
tayyabq8's Avatar
Moderator
 

Join Date: Nov 2004
Location: Bahrain
Posts: 554
my dear thnx for your prompt reply, but still no joy.

Code:
 
# pax -r -s ',^/home/compdir/home2/Rev83/data/PL/01,/home/temp,' "*PL*" < /dev/rct0
UX:pax: WARNING: - : This doesn't look like a tar archive
UX:pax: WARNING: - : Skipping to next file...
UX:pax: ERROR: *PL* not found in archive
i tried cpio also, but no luck.

Code:
# cpio -icvd "/home/compdir/home2/Rev83/data/PL/01/*.*" < /dev/rct0
by the way, i'm trying it on a SCO UNIXWARE 7.1.1 box.

thnx & rgrds,
Tayyab
Reply With Quote
  #6  
Old 04-23-2006
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Out of interest - do all the filest that you're trying to restore have a period ( . ) in them?

Cheers
ZB
Reply With Quote
  #7  
Old 04-23-2006
tayyabq8's Avatar
Moderator
 

Join Date: Nov 2004
Location: Bahrain
Posts: 554
Yeah, all files have . in names like:

Code:
# ls
01.PL.accts     01.PL.apymt     01.PL.balnc     01.PL.ctrls     01.PL.ptext
01.PL.accts.ir  01.PL.atran     01.PL.baxbf     01.PL.dfpst     01.PL.systm
01.PL.accts.wd  01.PL.atype     01.PL.cpdoc     01.PL.histr     01.PL.trans
01.PL.accts.wi  01.PL.ausig     01.PL.ctgry     01.PL.paymt
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
cpio, linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0