The Solaris 10 man page suggests:

       example% cd fromdir; tar cf - .| (cd todir; tar xfBp -)

Which has always worked for me under both Solaris 10 and previous incarnations.

On the other hand in Solaris "cp -pr" also does the right thing for me, perserving ownership, permissions, last mod date, etc, even cping entire multi-GB file systems.

In the distant past, I believe the -p option didn't work properly in SunOS across NFS (or was that Ultrix?). Seems to be ok now, though.

Arthur Gaer
[email protected]

Senior Systems Manager, Department of Mathematics
Harvard University, 617-495-1610, FAX: 617-495-5132


On Jan 8, 2009, at 5:41 PM, Brian O'Neill wrote:

GNU tar will strip the leading '/' off by default, unless you use the -P or --absolute-names option.

However, I would always caution against using absolute paths unless you KNOW what its going to do, especially with tar since there are plenty of versions that don't have this safety feature.

I don't think I've used "cp -r" in many years. The tar method was preferable as it maintained permissions, times, etc.

I'm using rsync a lot more now, especially between systems over ssh.


Kathryn Smith wrote:
I'm dating myself here. You could definitely do it to yourself on BSD, SunOS, and single digit Solaris versions. I haven't tried it on any Linux variants. Maybe they're more idiot-proof. :-)
-----------------------------------------------------------
This email address, [email protected], is my primary
email address. If you encounter difficulty with this address,
I can also be reached at [email protected]
--- On Thu, 1/8/09, David Allan <[email protected]> wrote:
From: David Allan <[email protected]>
Subject: Re: [BBLISA] System Backup thoughts and questions...
To: "Kathryn Smith" <[email protected]>
Cc: [email protected]
Date: Thursday, January 8, 2009, 5:14 PM
Hmm...perhaps it doesn't work on all *nix variants, but
I actually tried that before I posted it (on Fedora 10), and it did what I
would expect, created /backup/directory/source/directory/<contents>

I'll bear that in mind, though.

Dave


On Thu, 8 Jan 2009, Kathryn Smith wrote:

--- On Thu, 1/8/09, David Allan
<[email protected]> wrote:

tar cf - /source/directory | ( cd
/backup/directory ; tar
xvf - )

This is probabably obvious, but having shot myself in
the foot with it in the past, I can't let this go by
without pointing it out. If you try this approach, be
absolutely sure you use
tar cf - ./source/directory

The example here looks like you're using a full,
absolute path name starting at root for your source
directory. If you write that using a pipe, it goes right
back where it started, not to /backup/directory you've
just changed into.
Been there, done it to myself, spent a very long
weekend recovering the file system.
Kathryn


-----------------------------------------------------------
This email address, [email protected], is my
primary
email address. If you encounter difficulty with this
address,
I can also be reached at [email protected]


_______________________________________________
bblisa mailing list
[email protected]
http://www.bblisa.org/mailman/listinfo/bblisa

_______________________________________________
bblisa mailing list
[email protected]
http://www.bblisa.org/mailman/listinfo/bblisa
_______________________________________________
bblisa mailing list
[email protected]
http://www.bblisa.org/mailman/listinfo/bblisa

_______________________________________________
bblisa mailing list
[email protected]
http://www.bblisa.org/mailman/listinfo/bblisa

_______________________________________________
bblisa mailing list
[email protected]
http://www.bblisa.org/mailman/listinfo/bblisa

Reply via email to