Operating System - HP-UX
1834783 Members
2465 Online
110070 Solutions
New Discussion

Re: What is faster cp or cpio ?

 
SOLVED
Go to solution
thewho?
Frequent Advisor

What is faster cp or cpio ?

Hi everybody,
I'm copying several directories (each aprox. 20Gb large) within the same filesystem, currently I'm using a script that, basically, does this in the background:

cp -pr /fs1/sourcedir1/* /fs1/targetdir1 &
cp -pr /fs2/sourcedir2/* /fs2/targetdir2 &
cp -pr /fs3/sourcedir3/* /fs3/targetdir3 &

My questions are, Is there a way to improve the speed of these copies? Would cpio perform better than cp?

Thanks in advance,
Luis
We'll get through this together.
1 REPLY 1
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: What is faster cp or cpio ?

Luis,

I suspect that since you are doing so much thrashing around in the same filesystem that the command you use will matter very little.
I suspect that in this case running the 3 commands in parallel hurts more than it helps.
I would change your copy to something like this:
(cp -rf dir1/* cdir1/*; cp -rf dir2/* cdir2/*; cp -rf dir3/* cdir3/*) &

It would still execute in background - just one after the other. In any event, don't take my word for it; measure.

My 2 cents, Clay
If it ain't broke, I can fix that.