1848545 Members
8952 Online
104033 Solutions
New Discussion

how do I ?

 
SOLVED
Go to solution
Ragni Singh
Super Advisor

how do I ?

Hello,

How would I tar everything in the /opt directory, scp to another system and untar it in the same directory. Any help is greatly appreciated.
6 REPLIES 6
MARTINACHE
Respected Contributor

Re: how do I ?

cd /
tar cvf opt.tar opt/
rcp opt.tar SERVEUR:/

on SERVEUR
cd /
tar xvf opt.tar
Patrice MARTINACHE
Helen French
Honored Contributor

Re: how do I ?

Hi,

Try this:

# tar -cvf /tmp/opt.tar /opt
# rcp user_name@hostname:/tmp/opt.tar user_name@hostname:/tmp
# tar -xvf /tmp/opt.tar

Check 'man rcp' for details. Also remember that overwriting all files in /opt can cause troubles, unless you have the same OS and applications. Check the file system spaces before doing these.

HTH,
Shiju
Life is a promise, fulfill it!
MANOJ SRIVASTAVA
Honored Contributor

Re: how do I ?

Hi Sanman

This is how it is to be done
1. cd /opt
2. tar cvf /dev/rmt/0m test *
3. rcp test abc:/ ( abc is the other server)
4. go to abc and do a tar xvf test.

Please ensure you have plenty of space under /opt or in case you a another mount point just go ther and repeat the steps excpet give the full path when you do the tar .


Manoj Srivastava
Sridhar Bhaskarla
Honored Contributor
Solution

Re: how do I ?

Sanman,

It is not advisable to copy /opt filesystem as most of the softwares in /opt are installed via swinstall and you may get into problems later while you try to upgrade them.

However, if you wish to continue, then it should be easy. I assume you have ssh access too.

#cd /opt
#tar cf - . |ssh other_host \(cd /opt\; tar xf -\)

If you want to use scp, you need to have a filesystem bigger than /opt where you need to temporarily dump the bundle.

#tar cvf /somewhere/opt.tar /opt
#scp /somewhere/opt.tar other_host:/somewhere

Login to the other host
#tar xvf /somewhere/opt.tar

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Roger Baptiste
Honored Contributor

Re: how do I ?

hi,

Another quick way to copy is:

find /opt | cpio -ov | compress - | ssh '(cd /; uncompress - | cpio -ivumd)'


HTH
raj
Take it easy.
harry d brown jr
Honored Contributor

Re: how do I ?

Sanman,

What about just

scp -rp /opt remotehost:/

???


live free or die
harry
Live Free or Die