From owner-freebsd-questions@FreeBSD.ORG Wed Oct 1 18:03:11 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C394716A4B3 for ; Wed, 1 Oct 2003 18:03:11 -0700 (PDT) Received: from obsecurity.dyndns.org (adsl-64-169-107-253.dsl.lsan03.pacbell.net [64.169.107.253]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6FA9343FDF for ; Wed, 1 Oct 2003 18:03:10 -0700 (PDT) (envelope-from kris@obsecurity.org) Received: from rot13.obsecurity.org (rot13.obsecurity.org [10.0.0.5]) by obsecurity.dyndns.org (Postfix) with ESMTP id 5296966E2B; Wed, 1 Oct 2003 18:03:07 -0700 (PDT) Received: by rot13.obsecurity.org (Postfix, from userid 1000) id 3B6C0839; Wed, 1 Oct 2003 18:03:07 -0700 (PDT) Date: Wed, 1 Oct 2003 18:03:07 -0700 From: Kris Kennaway To: Pat Lashley Message-ID: <20031002010307.GA15545@rot13.obsecurity.org> References: <20031001122603.B71418-100000@floyd.gnulife.org> <3F7B0D5C.7080009@mac.com> <2156421632.1065047127@mccaffrey.phoenix.volant.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline In-Reply-To: <2156421632.1065047127@mccaffrey.phoenix.volant.org> User-Agent: Mutt/1.4.1i cc: freebsd-questions@freebsd.org Subject: Re: tar vs cp X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Oct 2003 01:03:11 -0000 --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 01, 2003 at 03:25:27PM -0700, Pat Lashley wrote: > --On Wednesday, October 01, 2003 13:22:36 -0400 Chuck Swiger=20 > wrote: >=20 > >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. >=20 > Another technique is 'cd /source ; find . -print | cpio -pdmv /dest'. >=20 > 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 --2fHTh5uZTiUOsy+g Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/e3lLWry0BWjoQKURAiWTAKD2tj7NlWnSXpbPQ9+fTgXt4iKNUwCcDoBz VebHIYt94KCXXdqBd9za6iM= =UXjW -----END PGP SIGNATURE----- --2fHTh5uZTiUOsy+g--