Copy entire directory structure from one system to another (Solaris v2.5.1)

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Theresa F. Hilber » Sat, 06 Feb 1999 04:00:00



I am running Solaris v2.5.1 and need to copy an entire directory structure
from one system to another, preserving owner, mode and symbolic links. What
is the best method (and proper syntax) to do this?  tar? ufsdump?  I need to
perform the copy dynamically, without creating a temporary file/tape during
the process.

    rcp -rp /directory-to-copy  newsystem:/directory-to-receive

won't work because it would change symbolic links to files on the receiving
system.

-Thanks-

- Theresa -

 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Zafar Al » Sat, 06 Feb 1999 04:00:00


Try, cd to directory to be copied and run:

tar cvf - ./* | (cd newdir; tar vxf -)

Where new dir is new location of the directory


> I am running Solaris v2.5.1 and need to copy an entire directory structure
> from one system to another, preserving owner, mode and symbolic links. What
> is the best method (and proper syntax) to do this?  tar? ufsdump?  I need to
> perform the copy dynamically, without creating a temporary file/tape during
> the process.

>     rcp -rp /directory-to-copy  newsystem:/directory-to-receive

> won't work because it would change symbolic links to files on the receiving
> system.

> -Thanks-

> - Theresa -


 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Ron Dille » Sat, 06 Feb 1999 04:00:00


Zafar,

cd $source;tar cf - . | (cd $dest;tar xfBp - ) works a little better.

Please excuse the hair splitting.

Ron


> Try, cd to directory to be copied and run:

> tar cvf - ./* | (cd newdir; tar vxf -)

> Where new dir is new location of the directory


> > I am running Solaris v2.5.1 and need to copy an entire directory structure
> > from one system to another, preserving owner, mode and symbolic links. What
> > is the best method (and proper syntax) to do this?  tar? ufsdump?  I need to
> > perform the copy dynamically, without creating a temporary file/tape during
> > the process.

> >     rcp -rp /directory-to-copy  newsystem:/directory-to-receive

> > won't work because it would change symbolic links to files on the receiving
> > system.

> > -Thanks-

> > - Theresa -

--
+--------------------------------------------------------+
|   Ron Dilley          Sr. UNIX Network Administrator   |

+--------------------------------------------------------+
 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by D. Roc » Sat, 06 Feb 1999 04:00:00


I prefer

cd $source; find . -depth -print | cpio -pdmv $dest

It should consume much less CPU power because only the file names are
transmitted over the pipe, so there will be much less context switches.

Daniel


: Zafar,

: cd $source;tar cf - . | (cd $dest;tar xfBp - ) works a little better.

: Please excuse the hair splitting.

: Ron

:>
:> Try, cd to directory to be copied and run:
:>
:> tar cvf - ./* | (cd newdir; tar vxf -)
:>
:> Where new dir is new location of the directory
:>

:>
:> > I am running Solaris v2.5.1 and need to copy an entire directory structure
:> > from one system to another, preserving owner, mode and symbolic links. What
:> > is the best method (and proper syntax) to do this?  tar? ufsdump?  I need to
:> > perform the copy dynamically, without creating a temporary file/tape during
:> > the process.
:> >
:> >     rcp -rp /directory-to-copy  newsystem:/directory-to-receive
:> >
:> > won't work because it would change symbolic links to files on the receiving
:> > system.

 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Leslie Mikese » Sat, 06 Feb 1999 04:00:00




Quote:>I am running Solaris v2.5.1 and need to copy an entire directory structure
>from one system to another, preserving owner, mode and symbolic links. What
>is the best method (and proper syntax) to do this?  tar? ufsdump?  I need to
>perform the copy dynamically, without creating a temporary file/tape during
>the process.

>    rcp -rp /directory-to-copy  newsystem:/directory-to-receive

>won't work because it would change symbolic links to files on the receiving
>system.

You can use rsh to make a ufsdump/ufsrestore, tar/tar, or cpio/cpio
pipeline.  I like rsync from http://rsync.samba.org/, but it is
really only better if you need to quickly refresh an out-of-date
copy but it works starting from scratch too.

  Les Mikesell

 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Alan Strassbe » Sun, 07 Feb 1999 04:00:00


Quote:>>I am running Solaris v2.5.1 and need to copy an entire directory structure
>>from one system to another, preserving owner, mode and symbolic links. What
>>is the best method (and proper syntax) to do this?  tar? ufsdump?  I need to
>>perform the copy dynamically, without creating a temporary file/tape during
>>the process.

        Another great solution is rsync ...

        http://samba.anu.edu.au/rsync/

                                        alan
--

 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Jerry Roger » Tue, 09 Feb 1999 04:00:00



> I am running Solaris v2.5.1 and need to copy an entire directory structure
> from one system to another, preserving owner, mode and symbolic links. What
> is the best method (and proper syntax) to do this?  tar? ufsdump?  I need to
> perform the copy dynamically, without creating a temporary file/tape during
> the process.

>     rcp -rp /directory-to-copy  newsystem:/directory-to-receive

> won't work because it would change symbolic links to files on the receiving
> system.

> -Thanks-

> - Theresa -

This method can be slow if you have a slow physical layer such as 10baseT.

Share using NFS a location large enough to hold the new data.  Make sure you
use the
anon=0 option.  Then mount the location on the source machine.  Change
directory with
the "cd" command to the source directory and invoke the following:

find ./ -depth -print | cpio -pdmv <target>

This will preserve links and permissions.

 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Remo Steble » Thu, 11 Feb 1999 04:00:00


It depends, if you have to copy the whole file system or only a part of it.

If it's only a part of it and you wouldn't like to make a temporary copy of the
files, I suggest the following way :

1) make a nfs mount from the target system to the source system (you must have
the necessary privileges on the target system)
2) make a tar :
    cd source dir
    tar cvf - . | (cd target dir ; tar xfp - )
   --> please refer the manual pages of tar for the correct syntax

Cheers,
Remo


> I am running Solaris v2.5.1 and need to copy an entire directory structure
> from one system to another, preserving owner, mode and symbolic links. What
> is the best method (and proper syntax) to do this?  tar? ufsdump?  I need to
> perform the copy dynamically, without creating a temporary file/tape during
> the process.

>     rcp -rp /directory-to-copy  newsystem:/directory-to-receive

> won't work because it would change symbolic links to files on the receiving
> system.

> -Thanks-

> - Theresa -

  remo.stebler.vcf
< 1K Download
 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Sriranga Veeraraghava » Thu, 11 Feb 1999 04:00:00



> I am running Solaris v2.5.1 and need to copy an entire directory
> structure from one system to another, preserving owner, mode and
> symbolic links. What is the best method (and proper syntax) to do
> this?  tar? ufsdump?  I need to perform the copy dynamically,
> without creating a temporary file/tape during the process.

Did you try the following:

tar -cvpf - <source dir> | ( rsh <host> -l <user> "/bin/sh -c 'cd <target dir> ; tar -xvpf - ; '")

This should allow you to copy file to a remote machine that has rshd
running (works with ssh, instead of rsh as well).


 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Thomas H Jones I » Fri, 12 Feb 1999 04:00:00





>> I am running Solaris v2.5.1 and need to copy an entire directory
>> structure from one system to another, preserving owner, mode and
>> symbolic links. What is the best method (and proper syntax) to do
>> this?  tar? ufsdump?  I need to perform the copy dynamically,
>> without creating a temporary file/tape during the process.

>Did you try the following:

>tar -cvpf - <source dir> | ( rsh <host> -l <user> "/bin/sh -c 'cd <target dir> ; tar -xvpf - ; '")

>This should allow you to copy file to a remote machine that has rshd
>running (works with ssh, instead of rsh as well).

though, depending on how deep the directory trees are and how long the
agregate filenames are, and how big any given files are, the above might
fail. Another approach that is likely to work is:

  cd sourceDir ; find . -print | cpio -mPo | rsh destHost "cpio -imPd destDir"

syntax might be off a bit, but you should get the idea.

-tom

 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Claus Neubronne » Sat, 13 Feb 1999 04:00:00


What about ufsdump and ufsrestore?

So if both partitions are local mounted, cd to the destination and say
ufsdump 0f - /dev/dsk/<partition> | ufsrestore rf -

regards
Claus




> >> I am running Solaris v2.5.1 and need to copy an entire directory
> >> structure from one system to another, preserving owner, mode and
> >> symbolic links. What is the best method (and proper syntax) to do
> >> this?  tar? ufsdump?  I need to perform the copy dynamically,
> >> without creating a temporary file/tape during the process.

 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Alan » Sun, 14 Feb 1999 04:00:00




>> I am running Solaris v2.5.1 and need to copy an entire directory
>> structure from one system to another, preserving owner, mode and
>> symbolic links. What is the best method (and proper syntax) to do
>> this?  tar? ufsdump?  I need to perform the copy dynamically,
>> without creating a temporary file/tape during the process.

>Did you try the following:

>tar -cvpf - <source dir> | ( rsh <host> -l <user> "/bin/sh -c 'cd <target

dir> ; tar -xvpf - ; '")
Btw, pls note that the <source dir> should be specified as ./<source dir>.
Otherwise, the absolute path will be used instead and you risk you get the
data overwritten.

Best Regards,
Alan

 
 
 

Copy entire directory structure from one system to another (Solaris v2.5.1)

Post by Matthew Hannig » Tue, 16 Feb 1999 04:00:00





>>> I am running Solaris v2.5.1 and need to copy an entire directory
>>> structure from one system to another, preserving owner, mode and
>>> symbolic links. What is the best method (and proper syntax) to do
>>> this?  tar? ufsdump?  I need to perform the copy dynamically,
>>> without creating a temporary file/tape during the process.

>>Did you try the following:

>>tar -cvpf - <source dir> | ( rsh <host> -l <user> "/bin/sh -c 'cd <target
>dir> ; tar -xvpf - ; '")
>Btw, pls note that the <source dir> should be specified as ./<source dir>.
>Otherwise, the absolute path will be used instead and you risk you get the
>data overwritten.

Also, use '&&' rather than ';'

Otherwise, if target-dir doesn't exist, or you made a typo,
you might write over the root dir.

Most unpleasant.

--
-       Matt