The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
Google UNIX.COM


UNIX and Linux Applications Questions involving software not covered by other forum go here. This includes Databases and Middleware.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
cpio error. alisevA3 UNIX for Dummies Questions & Answers 1 05-03-2006 09:04 AM
Please help with cpio on HP-UX soestx HP-UX 3 01-13-2006 03:07 PM
cpio kok UNIX for Dummies Questions & Answers 2 08-12-2004 05:57 AM
Help with cpio rooh UNIX for Dummies Questions & Answers 2 04-08-2003 03:41 PM
cpio wipro fluid power UNIX for Dummies Questions & Answers 2 06-18-2001 07:56 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-14-2008
Registered User
 

Join Date: Jan 2008
Posts: 6
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.
Reply With Quote
Forum Sponsor
  #2  
Old 01-14-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,653
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.
Reply With Quote
  #3  
Old 01-16-2008
Registered User
 

Join Date: Jan 2008
Posts: 6
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?
Reply With Quote
  #4  
Old 01-16-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,653
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
Reply With Quote
  #5  
Old 01-16-2008
Registered User
 

Join Date: Jan 2008
Posts: 6
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.
Reply With Quote
  #6  
Old 01-17-2008
Registered User
 

Join Date: Jan 2008
Posts: 6
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
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
cpio

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 01:38 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