1834154 Members
2784 Online
110064 Solutions
New Discussion

dd and cpio

 
SOLVED
Go to solution
Juan M Leon
Trusted Contributor

dd and cpio

Hello everyone, I am looking for some help with combining dd and cpio.


I found the following info usng the bellow command, however my brain is not working and I dont see how to use the same commands to list and restore the files....

Anyone have suggestions for me thanks

find /dir1 /dir2 /dir3 /dir4 /dir5 -depth | cpio -ov 2> /daily_files/`date -u +%d%b%y`.data | dd of=/dev/rmt/2m obs=1024k

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=856576&admit=-682735245+1190358717477+28353475
13 REPLIES 13
AwadheshPandey
Honored Contributor

Re: dd and cpio

use
dd if=/daily_files/`date -u +%d%b%y`.data of=/dev/rmt/2m obs=1024k
It's kind of fun to do the impossible
Juan M Leon
Trusted Contributor

Re: dd and cpio

Pandei,

Thank you for your prompt response, but I think I already placing the data to the tape in my command, what I want to do is read from the tape...

Thank you
Dennis Handly
Acclaimed Contributor

Re: dd and cpio

I assume you just reverse things, to list:
dd if=/dev/rmt/2m ibs=1024k | cpio -ivt

To restore:
dd if=/dev/rmt/2m ibs=1024k | cpio -idm

I assume obs= and -B are not required since you are sending it through the pipe.
Dennis Handly
Acclaimed Contributor

Re: dd and cpio

You probably can increase the performance by adjusting the block size to match the pipe:
obs=5120 | cpio -idmB
Pete Randall
Outstanding Contributor

Re: dd and cpio

Forgive the OT (off-topic) reply.

I'm trying to get the #Replies counter for this thread to increment itself.


Pete

Pete
Juan M Leon
Trusted Contributor

Re: dd and cpio

Denys,
Thank you for your reply, I will test your suggestions.

Juan M Leon
Trusted Contributor

Re: dd and cpio

Dennys,

I tried the commands you suggested. I will think it should work however i got the following error:

# dd if=/dev/st0 obs=1024k | cpio -ivt
dd: reading `/dev/st0': Cannot allocate memory
0+0 records in
0+0 records out
0 bytes (0 B) copied, 3.02205 seconds, 0.0 kB/s
cpio: premature end of archive


Any ideas...
Thanks in advance
Dennis Handly
Acclaimed Contributor

Re: dd and cpio

>Pete: I'm trying to get the #Replies counter for this thread to increment itself.

I had problems with this thread too. It would disappear and then it would still have 0 replies. ??

>I tried the commands you suggested. ... i got the following error:
# dd if=/dev/st0 obs=1024k | cpio -ivt
dd: reading `/dev/st0': Cannot allocate memory

I had ibs=1024k.

Also it appears you are using some foreign devil dd(1) because HP-UX's version doesn't print "Cannot allocate memory" or "0 bytes (0 B) copied, ...".
Peter Nikitka
Honored Contributor
Solution

Re: dd and cpio

Hi,

the name of the device file '/dev/st0' sounds to me like you work on Solaris.
Is there a remsh/ssh connection in play?

If all is local, it should not be necessary to use dd at all; your command should be identical to
find /dir1 /dir2 /dir3 /dir4 /dir5 -depth | cpio -ov 2> /daily_files/`date -u +%d%b%y`.data >/dev/rmt/2m

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Dennis Handly
Acclaimed Contributor

Re: dd and cpio

>Peter: sounds to me like you work on Solaris.

That would be pretty foreign. :-)

>If all is local, it should not be necessary to use dd at all;

Won't that have a trivially small block size, that's why they had tcio? At least -B should be used.
Peter Nikitka
Honored Contributor

Re: dd and cpio

Hi,

Dennis' remark should be included, Juan.
Give that a try:
find /dir1 /dir2 /dir3 /dir4 /dir5 | cpio -oBv 2> /daily_files/`date -u +%d%b%y`.data >/dev/st0

For verification, nothing has to be changed:
cpio -ivt
mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Dennis Handly
Acclaimed Contributor

Re: dd and cpio

>Peter: For verification, nothing has to be changed: cpio -ivt
Shouldn't that have a -B too? -iBvt
Juan M Leon
Trusted Contributor

Re: dd and cpio

Thanks all for your response.
First of all you were right, this is not HPUX. My apologies I thoug that dd and cpio will be the same in any platform.
I guess I was wrong the linux cpio is a GNU.
That explains the error reported.

At the end I used tar for some reason I was able to save the data (140GB) onto tape using cpio however I was unable to restore the data.

Thanks all for your advise.