Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 May 2002 10:59:58 -0400
From:      Paul Mather <paul@gromit.dlib.vt.edu>
To:        questions@FreeBSD.ORG
Subject:   Re: mv vs. tar [overlapping]
Message-ID:  <20020530145958.GA10665@gromit.dlib.vt.edu>
In-Reply-To: <bulk.11034.20020530021408@hub.freebsd.org>
References:  <bulk.11034.20020530021408@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 29 May 2002 23:19:00 -0400 (EDT) Jason Hunt <jhunt@lynden.on.ca> wrote:

=> When 'mv'ing files between locations on the same physical disk, then
=> the only filesystem operation that is being performed is to update the
=> directory tree.  An exception to this is when using 'mv' between different
=> physical disks or over NFS mount points, in which case the method for 'cp'
=> ends up being performed.
=> 
=> Basically, 'mv' will be much faster in most scenarios.  Refer to my other
=> e-mail from about an hour ago for when you might not want to use 'mv'.
=> 
=> Once again, I am no expert.  I'm probably wrong on a few points and/or
=> overlooked some things.  I havn't gotten that far yet in reading "The
=> Design and Implementation of the 4.4BSD Operating System", which
=> is an excellent book if you want to learn what goes on behind the scenes.
=> :)

It's a great book.  The source code for FreeBSD is rather informative
in these instances, too.  A perusal of /usr/src/bin/mv/mv.c yields the
fact that rename(2) is used to mv within filesystems; "cp and rm" is
used for mv across devices and filesystems---just as you say.

Cheers,

Paul.

e-mail: paul@gromit.dlib.vt.edu

"Without music to decorate it, time is just a bunch of boring production
 deadlines or dates by which bills must be paid."
        --- Frank Vincent Zappa

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020530145958.GA10665>