Operating System - HP-UX
1833170 Members
3713 Online
110051 Solutions
New Discussion

How to transfer files from one server to another server without taking backup and then restore ?

 
SOLVED
Go to solution
Deepu Chakravarty
Regular Advisor

How to transfer files from one server to another server without taking backup and then restore ?

I have two HP-UX 11i servers. Both the servers are in the network but don't have any dat storage device. I need to transfer data/files from one server to another server. How I can achive this ? Any help in this regard is highly appreciated.

Thanks.

10 REPLIES 10
Robert-Jan Goossens
Honored Contributor
Solution

Re: How to transfer files from one server to another server without taking backup and then restore ?

Hi,

If it is a one time job, you could use remote copy ( rcp or find/cpio ). These are not the most secure commands.

add the ip address in the /.rhosts file
ipaddress root

# find /source | cpio -ov | remsh other_server | " cd /copy ; cpio -idvum "

# rcp -p /source other_server:/copy/

Hope this helps,
Robert-Jan
Robert-Jan Goossens
Honored Contributor

Re: How to transfer files from one server to another server without taking backup and then restore ?

For refference HP-UX Secure Shell A.03.71.000

http://www.software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=T1471AA

Robert-Jan
Deepu Chakravarty
Regular Advisor

Re: How to transfer files from one server to another server without taking backup and then restore ?

Hi,
Thanks for the info.

I have few doubts.

I want to copy data from 'A' server to 'B' server. Now tell me how to use .rhosts file in this case ?
A. Clay Stephenson
Acclaimed Contributor

Re: How to transfer files from one server to another server without taking backup and then restore ?

Do a "man rhosts". That will explain everything fully including /etc/hosts.equiv.
One drawback to using rcp is that not all ownerships, groups, and permissions are retained even with the -p option.

You might consider creating a "tarball".
e.g
On host A:
cd to desired directory:
tar cvf /mydir/myfile.tar .



Next FTP or FTP myfile.tar to Host B:
then cd to desired directory
tar xvf /mydir/myfile.tar

The "tarball" or "cpioball" method will preserve all metadata.
If it ain't broke, I can fix that.
SS_6
Valued Contributor

Re: How to transfer files from one server to another server without taking backup and then restore ?

1.tar the files on ServerA
2.rcp to ServerB
3.untar on serverB (Command is tar-xvf ... do man tar for detail)
You car put a small script into cron and it will run automatically as per your need. Using tar,you will not lose file permissions and attributes.
By providing solutions I am helping myself
V.Tamilvanan
Honored Contributor

Re: How to transfer files from one server to another server without taking backup and then restore ?

Hi,

You need to make the systems as trusted by adding entries in .rhosts file. Then you can take the backup and restore by the following comand.

#cd /Localdirectory
# tar cvf - .| remsh remotesvr "(cd /remotedirectory ; tar xvf - )"
Sunil Sharma_1
Honored Contributor

Re: How to transfer files from one server to another server without taking backup and then restore ?

Hi,


As everybody said use .rhost file to create trusted relationship between servers.
1. In server A login as root and create file .rhosts in home directory of root. file will looks like.

serverB root

same way create .rhosts file in server B root user's home directory

serverA root

after this use rcp command to transfer files.

#rcp -r /var serverb:/var
*** Dream as if you'll live forever. Live as if you'll die today ***
Elmar P. Kolkman
Honored Contributor

Re: How to transfer files from one server to another server without taking backup and then restore ?

One of the things to bear in mind: check if your tar version supports files over 2 Gb or that you don't have files larger than 2 Gb, because the default tar can not handle those...

Another tool you might look at for what you want is rsync. It will only copy files that are not yet on the destination server, or have changed on the source server. It is in most cases a lot more efficient than copying the whole tree if you want both servers to be in sync. rsync can use ssh or rsh, so the .rhosts issues still exist. But with the explanation given so far that is not a problem. (Make sure the server you connect to can resolve the hostname from the IP address of the other server, otherwise the .rhosts won't work. And the permissions on the .rhosts file are important: 400 is the best mode: readable by the owner only).

Every problem has at least one solution. Only some solutions are harder to find.
KapilRaj
Honored Contributor

Re: How to transfer files from one server to another server without taking backup and then restore ?

Make necessary changes in ~root/.rhosts so that Server A's root can login to Server B as root w/o a password.

Login as root on Server A
cd $DIRECTORY
tar cvf - . |remsh "(cd $REMOTE_DIRECTORY; tar xvf -)"

Regds,

Kaps
Nothing is impossible
Geoff Wild
Honored Contributor

Re: How to transfer files from one server to another server without taking backup and then restore ?

If you need to do this all the time, look at rdist:

rdist - remote file distribution program

I use that for DR reasons, run nightly from cron:

# Copy myadm across to the DR site.
05 01 * * * /app/admin/drp/update-binaries.sh

# cat /app/admin/drp/update-binaries.sh
#! /bin/sh

# Keep the DRP copy of the vgpadm up-to-date.
# Currently the files are in:
#
# /home/vgpadm
#
# See the rdist(1M) distfile for a list of exclusions.

DRPDIR=/app/admin/drp
DRPHOST=server32

mount | grep /home > /dev/null 2>&1
if [ $? -eq 0 ]
then
( su - myadm -c "rdist -f $DRPDIR/distfile myadm"; ) 2>&1 |\
tee $DRPDIR/drp.log 2>&1 |\
mailx -s "VGPADM DRP rdist output" gwild@mydomain.com
fi


# cat distfile
MYDR = ( server32 )

#
# File systems to be copied over to the DR host.
# Don't use -R in install - so as not to remove files on destination host
MYADM = /home/myadm

myadm: ( ${MYADM} ) -> ( ${MYDR} )
install -w ;
except ${MYADM}/logfiles;


man rdist for mor information....

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.