Amanda-Users

Re: moved to new disk, now amanda wants to do level 0's on whole system

2003-11-14 15:08:47
Subject: Re: moved to new disk, now amanda wants to do level 0's on whole system
From: Eric Siegerman <erics AT telepres DOT com>
To: amanda-users AT amanda DOT org
Date: Fri, 14 Nov 2003 15:07:44 -0500
On Fri, Nov 14, 2003 at 09:20:23AM -0500, Jay Fenlason wrote:
> Also, cp/fr may not have correctly reset the modification times of the
> files when it copied them.  Oh, and they may not handle links well
> either.  To copy directory trees, I usually use "( cd /fromdir ; tar
> cf - . ) | ( cd /todir ; tar xpf -)", which preserves modification
> times, and permissions.

I've had problems with tar, too.  Unfortunately, that was so long
ago that I forget what they were.  Maybe it stores only mtime in
the tarball, and on extraction sets both mtime and atime to the
saved mtime value.  Oh, and I think it likes to (try to) copy the
contents of special files, FIFOs, and the like, instead of
recreating them in the destination tree.

Until recently, I used the cpio variant of your suggestion:
        cd /fromdir
        find . -depth -print0 | cpio -padmu0 /todir
(You need GNU find and cpio for the "0" part to work.  -depth is
to get the directories' mtimes copied properly.  It makes each
directory come *after* its contents in the file listing.  Without
-depth, the directory would come first; cpio would properly set
its mtime, and then stomp on it by creating the directory's
contents.)

But then I discovered rsync.  Rsync rocks.  "rsync -aH" copies
everything the kernel lets you copy (i.e. not ctimes, and not
inumbers).  The only problem with rsync is the weird way it gives
meaning to a trailing slash; these two are *not* equivalent:
        rsync -aH srcdir/ destdir
        rsync -aH srcdir destdir

Then again, I'm not sure whether either cpio or rsync can deal
with a username that's changed its numerical userid, or similarly
for groups.  I think some tar's can.  Or maybe it's cpio that can
handle that; can't remember.  And gtar probably doesn't have any
of those problems -- people are using it for backups after all
:-) -- but it's not always available, and even non-GNU cpio's do
everything but the "0" trick.

But all of those -- tar, cpio, rsync -- are kludges.  Is it just
me, or do other people also find it ludicrous that 30+ years on,
UNIX still doesn't have a proper copy command?

--

|  | /\
|-_|/  >   Eric Siegerman, Toronto, Ont.        erics AT telepres DOT com
|  |  /
It must be said that they would have sounded better if the singer
wouldn't throw his fellow band members to the ground and toss the
drum kit around during songs.
        - Patrick Lenneau