Re: Re: tar vs cp

2003-10-02 Thread Mark Terribile

 tar handles symbolic links properly, whereas
 cp will copy through  the contents of the link.

 Also true for cp -R? :-)

 No, but not all systems have cp -R, although
 FreeBSD does.  Likewise for the -p or
 --preserve-permissions option...

tar requires two executions, one to create the
archive and one to remove it.  This has advantages
and disadvantages.  cpio -p  can do it in one pass,
but requires that you expand the directories with
 find  or provide a list file.  Again, sometimes a
good thing, sometimes not.  cpio  can also create a
tree of links if you are on the same file system.
Useful for moving large files with minimal disk
activity (remove the original links afterwards).

   Mark Terribile


__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


tar vs cp

2003-10-01 Thread Jamie


I've been told in the past that if you have a series of directories
with subdirectories that you need to copy to another location on a disk,
it is better to tar the directory, move the tarred file to the
destination, and then untar it, rather than using cp to copy the directory
and all of its contents.

I don't know what the actual rationale is for this. Can anyone explain
why it is oftentimes better to tar something rather than using cp when
copying directories and their contents?




Thanks,

   - Jamie



A friend is someone who lets you have total freedom to be yourself.

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar vs cp

2003-10-01 Thread Chuck Swiger
Jamie wrote:
[ ... ]
I don't know what the actual rationale is for this. Can anyone explain
why it is oftentimes better to tar something rather than using cp when
copying directories and their contents?
tar handles symbolic links properly, whereas cp will copy through the contents 
of the link.

--
-Chuck
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar vs cp

2003-10-01 Thread Felix Deichmann
Chuck Swiger wrote:

tar handles symbolic links properly, whereas cp will copy through the 
contents of the link.
Also true for cp -R? :-)

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar vs cp

2003-10-01 Thread Charles Swiger
On Wednesday, October 1, 2003, at 04:03 PM, Felix Deichmann wrote:
Chuck Swiger wrote:
tar handles symbolic links properly, whereas cp will copy through 
the contents of the link.
Also true for cp -R? :-)
No, but not all systems have cp -R, although FreeBSD does.  Likewise 
for the -p or --preserve-permissions option...

--
-Chuck
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar vs cp

2003-10-01 Thread Viktor Lazlo


On Wed, 1 Oct 2003, Charles Swiger wrote:

 On Wednesday, October 1, 2003, at 04:03 PM, Felix Deichmann wrote:
  Chuck Swiger wrote:
  tar handles symbolic links properly, whereas cp will copy through
  the contents of the link.
 
  Also true for cp -R? :-)

 No, but not all systems have cp -R, although FreeBSD does.  Likewise
 for the -p or --preserve-permissions option...

From the manpage:

   Note that cp copies hard linked files as separate files.  If you
   need to preserve hard links, consider using tar(1), cpio(1), or
   pax(1) instead.

Cheers,

Viktor
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar vs cp

2003-10-01 Thread Pat Lashley
--On Wednesday, October 01, 2003 13:22:36 -0400 Chuck Swiger 
[EMAIL PROTECTED] wrote:

Jamie wrote:
[ ... ]
I don't know what the actual rationale is for this. Can anyone
explain why it is oftentimes better to tar something rather than
using cp when copying directories and their contents?
tar handles symbolic links properly, whereas cp will copy through the
contents of the link.
Another technique is 'cd /source ; find . -print | cpio -pdmv /dest'.

But none of the built in tools seem to preserve links, flags, and
sparseness.  If you want as close to a true copy as possible, check
out the cpdup port.


-Pat
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar vs cp

2003-10-01 Thread Kris Kennaway
On Wed, Oct 01, 2003 at 03:25:27PM -0700, Pat Lashley wrote:
 --On Wednesday, October 01, 2003 13:22:36 -0400 Chuck Swiger 
 [EMAIL PROTECTED] wrote:
 
 Jamie wrote:
 [ ... ]
 I don't know what the actual rationale is for this. Can anyone
 explain why it is oftentimes better to tar something rather than
 using cp when copying directories and their contents?
 
 tar handles symbolic links properly, whereas cp will copy through the
 contents of the link.
 
 Another technique is 'cd /source ; find . -print | cpio -pdmv /dest'.
 
 But none of the built in tools seem to preserve links, flags, and
 sparseness.  If you want as close to a true copy as possible, check
 out the cpdup port.

using tar | tar instead of cp -r is usually faster because it makes
more efficient use of disk I/O, because reads and writes are queued up
at the same time, from the two processes) whereas cp -r reads and
writes chunks sequentially (it's actually implemented using mmap'ed
memory, which gains some efficiency, but it's still a sequential
process because there's only one single-threaded cp running).

Kris



pgp0.pgp
Description: PGP signature