1835177 Members
2738 Online
110077 Solutions
New Discussion

Re: CPIO command

 
SOLVED
Go to solution
Kenn Chen_1
Advisor

CPIO command

I have machine A and machine B for my case. Machine A exported one filesystem to Machine B and B need to copy (with permission and owner) all the files in this nfs mounted filesystem (A) into B local filesystem. So, please guide me how to use cpio to copy the files into my local filesystem. Thanks.
14 REPLIES 14
harry d brown jr
Honored Contributor

Re: CPIO command


rcp -rp systemA:/SOURCE_filesystem systemB:/TARGET_filesystem


NFS would be a waste of time!! And cpio would be a waste of computer cycles, when a straight data copy is needed!

live free or die
harry
Live Free or Die
Michael Tully
Honored Contributor

Re: CPIO command

Harry is correct, a 'rcp' would be better.....

But...

if you really want to do it. e.g
# cd /mynfsfs
# find . -xdev | cpio -pdumv /mynewdir
Anyone for a Mutiny ?
Kenn Chen_1
Advisor

Re: CPIO command

But i need to remain the link of all files as well. rcp can do it ?
Michael Tully
Honored Contributor

Re: CPIO command

The options provided by Harry will do this.

# rcp -rp

If in doubt have a look at the man page on 'rcp' for clarification.
Anyone for a Mutiny ?
S.K. Chan
Honored Contributor

Re: CPIO command

You don't really need to mount the FS for you to be able to cpio between systems (while retaining the files/dirs permission/ownership and sym links). Let say you need to copy everything under /opt/dirA from serverA to /opt/dirB on serverB. First setup appropriate .rhosts entry to make sure root on serverA can remsh to serverB. Then run this from serverA.
# cd /opt/dirA
# (find . -xdev|cpio -coax)|remsh serverB "cd /opt/dirB;cpio -icdmuxla"
That should do it. I suggest trying it out first with some dummy directory/files to make sure you're comfortable with it before doing the actual cpio.
Kenn Chen_1
Advisor

Re: CPIO command

Mr chan,

I like your way and it will not effect my source system...right ? I means my cpio will not delete or modify any files on my source system ?
T G Manikandan
Honored Contributor

Re: CPIO command

cp -rp won't that do the task.


THanks
S.K. Chan
Honored Contributor
Solution

Re: CPIO command

I use it all the time to move user around from local machine to server and vice versa. It's very effective for a one time move ie copying to a destination system where the files/dirs does not exist yet. In my example I used "-u" in the cpio to copy unconditionally because I'm assuming you're doing a fresh copy. If destination files existed and with a newer timestamp and you do not want to overwrite it , don't use "-u". This operation does not in any way delete or modify your source files/directories.
Kenn Chen_1
Advisor

Re: CPIO command

I got this error during the command

N4000 / HP :root/opt>(find . -xdev|cpio -coax)|remsh k460 "cd /opt;cpio -icdmuxla"
cannot unlink current (errno:26)
Cannot create (errno:26)
cannot unlink current (errno:26)
Cannot create (errno:26)
cannot unlink current (errno:26)
Cannot create (errno:26)
1607610 blocks
1607610 blocks
T G Manikandan
Honored Contributor

Re: CPIO command

Error no 26 is Text file busy.

Probably those files are used by some processes.
you have to shutdown those processes for to prevent these messages

Thanks
T G Manikandan
Honored Contributor

Re: CPIO command

probably the processes are the disk array daemon processes.
They are in /opt/pred/bin.

S.K. Chan
Honored Contributor

Re: CPIO command

The error you're getting probably indicate that those files are active and in used. Why would you want to copy everything under /opt to another system ? I was under the impression you will be copying data or specific application.
Kenn Chen_1
Advisor

Re: CPIO command

hi,

cpio only limited to 2 GB size ? I want to cpio 30 GB filesystem to remote machine. Possible ?
H.Merijn Brand (procura
Honored Contributor

Re: CPIO command

The cpio that is shipped with HP is limited to 2Gb *per file*. The complete archive (or throughput) has no limit, because it is a stream.

GNU cpio lifts the 2Gb/file limit. GNU cpio is - amongst a lot of other sites - available from my ITRC page on https://www.beepz.com/personal/merijn/
Enjoy, Have FUN! H.Merijn