Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy file systems across servers

Status
Not open for further replies.

nitinkgoud

IS-IT--Management
Jun 28, 2006
87
US
Hi Guys,
How can i copy file systems across servers

Example:
copy /netscape/ns-home/docs/cmg from server1
TO
server2 /tools/chb/netscape/server6/docs/cmg

I need to do it using tar command but which switches to use, i also need to preserve the permissions.
 
rcp will help with copying files across trusted hosts. If I remember correctly, it preserves permissions as well.
 
scp or rcp, I believe you have to use the '-p' to preserve the permissions.


if it is a directory you need to tar, then

tar cvf directoryname.tar directoryname <enter>

after it tars ups, you may as well gzip it.

gzip directoryname.tar <enter>


you should have as an outcome: directoryname.tar.gz

now copy this file to the other server



to unzip and untar, Use

gunzip directoryname.tar.gz

then

tar xvf directoryname.tar

now your directory is on the other server.
 
You have to be careful how you specify the directory when you tar it up. If you give the entire path to the directory, it will untar to that exact path when you untar it. The best way is to do a relative path to tar it.

Something like...
Code:
# on server1
cd /netscape/ns-home/docs
tar cvf cmg.tar cmg
This way, all of the files in the tar will be named like...

cmg/file1
cmg/file2
cmg/dir1/anotherfile

So, ftp the file over to server2 (in binary mode), and do the following...
Code:
cd /tools/chb/netscape/server6/docs
tar xvf cmg.tar
You'll have to do that as root, or as the new owner of the files.

You can also do it directly with [tt]rcp[/tt] if you can use it...
Code:
rcp -pr /netscape/ns-home/docs/cmg server2:/tools/chb/netscape/server6/docs/cmg
See the man pages for [tt]rcp[/tt] and [tt]rhosts[/tt] for more information.
 
you can pipe a tar through ssh too to accomplish the same thing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top