Download Files from one server to another

I'm trying to find a easy way to move from my old server to my new server.  I have about 30 gigs on my old server and I've purchased my new server.  What I'm trying to keep from doing is downloading all that data to my home computer then uploading it super slow to my new server.  Is there a way from SSH on my new server to pull the files from the old server?
LVL 12
Nathan RileyFounderAsked:
Who is Participating?
 
eagerCommented:
Using rsync over ssh is the right thing to do, but copying all of the root (as in farzanj's example) is not a good idea. Unless both systems are identical, this can trash the receiving system.  At best, it will copy tons of data that you don't want or need, like /bin, /usr, /lib, /var.  And you need to do this as root, which is also a bad idea.  

BTW, farzanj's rsync command copies from the system you are logged into TO the remote system.  

Log in to the new system.  Copy the data that you want from the remote system to the system you are logged in to.
   rsync -avz user@remote:/path/to/my/data  /path/to/my/data

The -z says to use compression.  Always a good idea with a remote connection.
0
 
farzanjCommented:
One of the machines should have sshd running on it then you can use rsync.

What partitions do you want to do, I can give you the exact command

Which server has ssh daemon running on it

Use rsync -av.

Do you want to skip any folders, etc?
0
 
Nathan RileyFounderAuthor Commented:
No I want to take everything from one to the other, but my home upload speed is only 100k/sec so that would take forever.  I figured their should be a way to use my servers with one another to do the transfer.  They both have SSH.  I'm not sure what SSHD is or rsync?  I thought I could just run some get command.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
farzanjCommented:
So you have ssh on the new server?

logon to the old server as root

The issue command

rsync -av /path  user@newServerIP:/path
0
 
farzanjCommented:
Yes, you can connect them with a network cable.  Get to the old server and try doing

ssh root@IP_ADDRESS_OF_NEW_SERVER
0
 
farzanjCommented:
Can  you do it?  If you want to copy everything, you can do

rsync -av /  root@newServerIP:/


But you may run into problems considering that you may overwrite some basic files/user accounts etc.  It would be better to skip some partitions or folders.
0
 
Nathan RileyFounderAuthor Commented:
Ah, ok I see what you mean.  No the servers are at 2 different data centers so no luck connecting with network cables.  I will have to do the other commands.  I only want to copy the home folder now that you mention it.  All my websites and data are within it.  How can I use rsync to do this, should I do command from old or new server?  Is rsync even installed on them?  They are running CENTOS 5.5
0
 
farzanjCommented:
Is there a path between the two servers?  Can you ping from one server to another?  Can you ssh from one server to another using its IP address

Get on one server and issue this command
ssh root@otherserver

You should have rsync on them, if you are running ssh.

If you know what partitions you want to copy, that would help.  Otherwise, I will have to do

rsync -av --exclude=/boot --exclude=/etc / root@otherServer:/
0
 
farzanjCommented:
Do you know the IP addresses of both machines OR the domain names?  This info goes after @ sign in rsync or ssh syntax.
0
 
Nathan RileyFounderAuthor Commented:
Yes I will have the IP of both.  1 is up right now (old server).  The new one is still being setup so when I do get it I will try this out and get back to you.
0
 
expert_tanmayCommented:
I concur with eager, I have one more idea why not create tarballs on the old machine till your new machine gets ready. tar -cvzf data.tar /path/to/data then copy them to the new machine this will also help you keep the permissions of the files on the old system as it is on the new system.

Cheers..
0
 
eagerCommented:
One disadvantage to creating a tarball and then copying it over is that you will need space to save the tar file.  Depending on how much compression you get, to save 30Gb could take and additional 15Gb or more.  Also, if you have connection problems transferring the tarball, you have to start over again.  

Rsync is incremental and doesn't require extra disk space.  If the connection is broken, you can re-run rsync and it will copy the remaining files, skipping over the ones which are already copied.

On the other hand, rsync can be confusing.  The -n (dry run) option will not really tell you what it will copy.  And the nonsense about what a slash at the end of the path means always leaves me wondering if I have the command right.  If you have enough space on both servers and a reliable connection, use tar.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.