Selective restore from a cpio tape archive


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Selective restore from a cpio tape archive
# 1  
Old 04-23-2006
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
# 2  
Old 04-23-2006
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
# 3  
Old 04-23-2006
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
# 4  
Old 04-23-2006
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 10:46 AM..
# 5  
Old 04-23-2006
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
# 6  
Old 04-23-2006
Out of interest - do all the filest that you're trying to restore have a period ( . ) in them?

Cheers
ZB
# 7  
Old 04-23-2006
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

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Cpio - input files (from list) are stored in different order inside cpio archive - why?

Due to budget constraints I have to reinvent an Enterprise backup system in a SPARC (sun4v) Solaris estate (10 & 11). (yep - reinvent wheel, fun but time consuming. Is this wise?! :confused: ) For each filesystem of interest, to try to capture a 'catalog' at the front of each cpio archive (for... (1 Reply)
Discussion started by: am115998
1 Replies

2. UNIX for Beginners Questions & Answers

CPIO Restore

Please note that using the command cpio to back up to tape was successful. Used the below command: time find /accts -print | cpio -oa --block-size=512 --format=newc --verbose -O /dev/nst0 I'm trying to restore from tape of a particular file and having issues. Below is the command to restore... (7 Replies)
Discussion started by: isoabv
7 Replies

3. UNIX for Beginners Questions & Answers

Cpio Restore didnt go to plan

Hello folks, one of the RAID drives in our SCO system crashed recently and being hot swap it was replaced. Problem was that on boot it stops at: Checking protected password and protected subsystem databases.... First I did #authck -a and checked /etc/auth/system/ttys as per instructions in a... (7 Replies)
Discussion started by: Redstar
7 Replies

4. UNIX for Dummies Questions & Answers

Cpio archive help

Hi I'm new to the forum and looking for some help with cpio archive creation. I have a bunch of directories that I need to make into a cpio archive. The problem I'm having is that when I input the commands I get the cpio archive but it creates a duplicate of the archive inside the archive... (4 Replies)
Discussion started by: reeves1985
4 Replies

5. UNIX for Dummies Questions & Answers

Remote Tape Backup Using cpio

Hi all, I've got two HP machines running HP-UX 11.31 and would like to remotely backup one server onto another server's tape unit using the cpio command. The two servers use a secured communication channel, i.e ssh. Kindly help, Koketso (1 Reply)
Discussion started by: Koketso
1 Replies

6. Shell Programming and Scripting

Appending a CPIO to an existing archive

I created a CPIO archive I wanted to add addition data to it but am having issues: -rw-r--r-- 1 test test 629295104 2011-10-28 12:41 /home/test/Downloads/test.cpio I tried: sudo find /tmp -depth | cpio -oAO /home/test/Downloads/test.cpio cpio: premature end of file and (1 Reply)
Discussion started by: metallica1973
1 Replies

7. UNIX for Dummies Questions & Answers

Unable to restore cpio archive to a directory

Hello Every one, I want to back up all passwd files to /xyz/passfiles.cpio and Then restore them to /abc directory. Here is what I wrote: find / -name passwd | cpio -oc > /tmp/passwd.cpio and to restore cd abc cpio -ium < /tmp/passwd.cpio I can not find the files restored to /abc... (2 Replies)
Discussion started by: drdigital_m
2 Replies

8. UNIX for Dummies Questions & Answers

restore cpio file

Hi, under unix aix , i had to put a catostrophic patch from an editor ... i had first made a cpio backup connected root cd /application find . –print | cpio –ocvBm > /sauvegarde/sauvegarde.cpio Does someone know the command to restore my cpio backup ? thanks in advandce to everyone ... (7 Replies)
Discussion started by: bzh35
7 Replies

9. SCO

cpio Backup and restore to spare server fails

Our company purchased a spare HP ML350 server - identical to current one in use to act as minimal downtime replacement should the inevitable happen. After install of OS 5.0.7 and restore of cpiobackup I get this message: -: Syntax error: Hostname= $inexpected The SCO licence policy... (4 Replies)
Discussion started by: moondogi
4 Replies

10. UNIX for Dummies Questions & Answers

cpio restore - relative pathname

SCO/Caldera Unixware 711 Hi Friends, I have a cpio file which was created using relative pathnames. the relative pathname is users/data/* I want to restore these files to a different directory with cpio. An example restore directory is /home/suresh Is this possible ? Can someone... (4 Replies)
Discussion started by: sureshy
4 Replies
Login or Register to Ask a Question