cpio question


 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications cpio question
# 1  
Old 01-14-2008
cpio question

I apologize in advance if someone else has posted a similar question and I overlooked the answer in the forums, so here goes.

i'm using cpio to retrieve data from a tape and the switches i'm using are
cpio -AvicdumkB -I/dev/rct0

now the data i'm trying to restore is a specific couple of directories off of /u. I created a /tape directory under /u to put all the data from the tape into, so that went something like this.

pwd = /u
mkdir tape
chmod 777 tape (this is only a temp directory and only 1 person (me) has root access so 777 is ok for the permissions)
cd tape

Now what I would like to do is restore only a few directories form that tape and have them restored into the tape directory but i'm not familiar enough with the cpio command to change the switches that I currently use.

The directory structure that I would like to restore is set up like this:

/u/prd
/u/prd2
/u/prd3
and so on up to prd8

My question is, is there a way to use cpio to restore only the prd directories from the tape without having to restore the whole tape backup?
If it makes any difference, each prd directory contains only a single .dat file. Also, i'm running SCO 5.0.7 with mp3 installed.

Many thanks with any assistance you can provide in advance. I've tried reading the man pages for cpio and they read like stereo instructions.
# 2  
Old 01-14-2008
I going to need to guess here because most cpio version do not have that A option. Good thing you have it though... it gives you a good shot at this. I look up that A on the SCO web site. It turns absolute paths into relative paths by removing the leading slash. If I read this right, you will wind up with /u/tape/u/prd and so on. Make sure you cd into /u/tape. Then you run your cpio command with patterns to match the directories you want to restore. The problem is that I don't know what you want to exclude. Is there a /u/prd9 and /u/prd10, etc? So to keep it simple just try this...

cpio -AvicdumkB -I/dev/rct0 u/prd u/prd2 u/prd3 u/prd4 u/prd5 u/prd6 u/prd7 u/prd8

I think this will work, but I have no way to test it. Let us know if it works ok.
# 3  
Old 01-16-2008
It's a start

I typed in the command as you had it in your response and it restored the directories but not the file in those directories. I even tried a variation of that command by putting the file name, so it looked something like this

pwd
/u/tape
cpio -AvicdumkB -I/dev/rct0 /u/prd/mumps.dat

but it only restored the directory so i'm kind of at a loss. I don't understand why it would go so far as to restore the directory but not the file. Any suggestions?
# 4  
Old 01-16-2008
Notice that I had no leading slash on my patterns but you show a leading slash. Try:
cpio -AvicdumkB -I/dev/rct0 u/prd/mumps.dat
# 5  
Old 01-16-2008
missed that

Didn't notice that you left out the leading slashes. Amazing how you manage to overlook the smallest things when you get used to doing things a certain way. I'll try it again w/out the leading slash. Thanks again for your time and assistance, I really do appreciate it.
# 6  
Old 01-17-2008
Got it

I managed to figure it out. After creating the tape directory and trying a few different combinations of the switches I finally got it with using wildcards.

cpio -AvicdumkB -I/dev/rct0 u/prd*/MUMPS*

Mumps is the name of the file and it's extension is .DAT in the prd directory but it's .EXT in each subsequent directory so cpio will play nice with the wilcard.

Many thanks for pointing me in the right direction. I fear I would have been pulling my hair out trying to figure this out.

Hnelson
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. Solaris

About cpio command

i need to extract cpio file archived full path to /restore/ (not full path or fullpath under this directory ) i can't find option for cpio please help me example. i have cpio file archive /etc/* and i need to extract file to /restore #cpio -ivBcdmu < xx.cpio but data from cpio not... (3 Replies)
Discussion started by: infjustice
3 Replies

3. SCO

CPIO listing from tape question...

Hi. I have this old server onto which i needed to list the content of a tape. This is a SCO box (SCO_SV 3.2 5.0.6 i386) and backup was done using cpio. #tape status status : ready beginning-of-tape soft errors : 0 hard errors : 0 underruns : 0 #dtype /dev/rct0 /dev/rct0 ... (5 Replies)
Discussion started by: Stephan
5 Replies

4. UNIX for Advanced & Expert Users

cpio versus cp

I am copying a file system to another one. someone suggest me use find . -print |cpio -pdmv but I think cp -r should do the same thing. Am I right? In addition, by using " find . ", I got all the file names,, why do I have to use the -print option? Thanks a lot! (1 Reply)
Discussion started by: fredao
1 Replies

5. HP-UX

Please help with cpio on HP-UX

Hello all ... I am an Oracle DBA that got stuck in a HP-UX SA role and need some help figuring out a UNIX problem. According to Oracle documentation, I am to issue the following command ... cpio -idcmv <file_name> However when I do, the server just hangs there and does nothing til I... (3 Replies)
Discussion started by: soestx
3 Replies

6. UNIX for Dummies Questions & Answers

cpio

Hello, how can I restore files from a DAT using CPIO ? If I make : # mkdir save # cd /save # cpio -icumvdB </dev/rct0 Does the archive restore only in the directory /save ? And how can I restore a specified file from the DAT with the cpio command ? How can I know the size of the... (2 Replies)
Discussion started by: kok
2 Replies

7. UNIX for Advanced & Expert Users

CPIO related

i have a cpio.z file containing another cpio file . I want to view the contents of the cpio file inside . How to do it? my parent cpio file invoked with cpio -itv looks some thing like ompmum4 sbadgire> zcat 210_2122_ECP_03.cpio.Z| cpio -itv -rwxr-xr-x 1 20519 20519 761856... (1 Reply)
Discussion started by: rraajjiibb
1 Replies

8. UNIX for Dummies Questions & Answers

cpio problem

Hi everyone. I'm needing some help with this. I've made some backups on the same tape using cpio. With cpio -civt < /dev/rmt/0un i could see the first backups files, but now i'm getting the next messages <<End of medum on "imput">> <<To continue, type device/file name when ready>>. I... (3 Replies)
Discussion started by: livortiz
3 Replies

9. UNIX for Dummies Questions & Answers

Help with cpio

Hi all, Please help me with the extraction of files from a cpio. what I mean is basically I have received a file from someone i.e rooh.cpio. this file rooh.cpio contains various files in it. I want to know how I can extract the files and copy them to a different directory . Your quick... (2 Replies)
Discussion started by: rooh
2 Replies

10. UNIX for Dummies Questions & Answers

cpio

by mistake I deleted all the files in /usr2/symix/users/wfpsys/tpsc/ directory. full backup has taken yesterday using "CPIO" command and I am able to view the files from tape also using cpio command. but i couldn't able to restore back the files. Can you please help me immeditely by giving the... (2 Replies)
Discussion started by: wipro fluid power
2 Replies
Login or Register to Ask a Question