"Derek D. Martin" wrote:

> At some point hitherto, Benjamin Scott hath spake thusly:
> > On Sat, 9 Feb 2002, mike ledoux wrote:
> > >     # tar cBlf - . | (cd /mnt/tmp && tar xBspf -)
> >
> >   Why not "cp -a"?  Are you just used to old-school Unix, or is there
> > something wrong with "cp" we should know about?
>
> Even on newer Unix systems, IIRC, cp can't handle certain file types,
> like sockets/fifos, and device files.  For that reason, unless one is
> positive there are none of the above, tar is safer.

I've used cp -a with no problems from several years now. I used to use the
tar pipe construct until I confirmed cp worked to my satisfaction. I've
copied /dev with no problems at all.

If copying /, do remember to exclude /proc by cp -ax (-x is equivalent to
the one file system -l of tar).

>From the man page for cp:

-a = same as -dpR

-d = preserve links
-p = preserve file attributes
-R = recursive

Specifically, there is a note about -r saying:
       -r     copy recursively, non-directories as files WARNING:
              use -R instead when you might  copy  special  files
              like FIFOs or /dev/zero

While I've never encountered a problem, sparse files might be created
differently.

Again from man cp:
       By  default,  sparse  SOURCE files are detected by a crude
       heuristic and the corresponding DEST file is  made  sparse
       as  well.  That is the behavior selected by --sparse=auto.
       Specify --sparse=always to create a sparse DEST file when�
       ever  the  SOURCE  file contains a long enough sequence of
       zero bytes.  Use --sparse=never  to  inhibit  creation  of
       sparse files.

begin:vcard 
n:Jenkins;Dan
tel;fax:1-603-627-7513
tel;work:1-603-627-0443
x-mozilla-html:TRUE
url:http://www.rastech.com
org:Rastech Inc.;*** Technical Support Excellence for a Quarter Century
adr:;;21 Curtis Lane;Bedford;NH;03110;USA
version:2.1
email;internet:[EMAIL PROTECTED]
title:Technical Director
fn:Dan Jenkins
end:vcard

Reply via email to