[plug] tar vs cp -r

Quintin Lette qlette at gmail.com
Thu Mar 10 18:56:12 WST 2005


On Thu, 10 Mar 2005 18:06:27 +0800, Quintin Lette <qlette at gmail.com> wrote:
> When I copied my Solaris Jumpstart installation source to my linux
> server, the only way I used to successfully do it was
> 
> tar cfp /jumpstart - | ssh scorpion -C "( cd /jumpstart && tar xf - )"
>
oops that should be 

tar cfp - /jumpstart | ssh scorpion -C "( cd /jumpstart && tar xf - )"

what was I thinkin..
 
> however within linux itself, especially on the same system I have
> never had problems with cp -a solaris, as with most unix variants,
> does not have gnu cp and therefore the -a switch, thus you need to use
> tar.
> 
> the p switch is for preserving links, the reason why my jumpstart
> didn't work with cp -r over nfs. The - does the same standard out bit,
> and standard out means you can copy over ssh etc. With Linux I would
> just use standard cp -a which should be faster (your not copying to an
> intermediate point) but I always use tar on Solaris and between
> systems.
> 
> Cheers
> 
> Quintin
> 
> On Thu, 10 Mar 2005 17:51:03 +0800, Jim Householder
> <nofixed at westnet.com.au> wrote:
> > Craig Ringer wrote:
> > > On Thu, 2005-03-10 at 14:51 +0800, Jim Householder wrote:
> > >
> > >>Hi
> > >>
> > >>On a number of occasions I have seen a preference shown for using tar to
> > >>move large trees rather than cp -r.
> > >
> > >
> > > In addition to the points made by others, tar works well over ssh (so
> > > long as you use no-pty, as I found out) and can be *dramatically* faster
> > > than using `scp -r'.
> > >
> > > It's also possible to pipe a list of files to be copied, generated by,
> > > eg, `find', into tar (or at least star) or add restrictions like files
> > > modified after a certain date. `cp -r' isn't really all that smart.
> > >
> > > For just straight copies, cp -aR should do the job nicely. More complex
> > > tasks can benefit from using an archiver (like tar, star, pax, etc) or
> > > special tool like rsync or unison.
> > >
> > > --
> > > Craig Ringer
> >
> > Thanks guys.  I'm copying distros (2.2, 3.2GB) from dvd to disk for a
> > network install.  I've decided to use tar from /media/dvd:
> >     tar cOv * | tar xC /distros/suse -
> >
> > It seems to be working, but it's really stuffing the mouse around.
> > *very* erratic movement with random click-and-drags, and very slow
> > response.  top indicated some idle time but it seems like the system is
> > seriously cpu-bound.
> >
> > Jim
> > _______________________________________________
> > PLUG discussion list: plug at plug.org.au
> > http://www.plug.org.au/mailman/listinfo/plug
> > Committee e-mail: committee at plug.linux.org.au
> >
>



More information about the plug mailing list