[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Download Files from one server to another

Posted on 2011-05-06
12
Medium Priority
?
388 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:Nathan Riley
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 35706858
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
 
LVL 12

Author Comment

by:Nathan Riley
ID: 35706891
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
 
LVL 31

Expert Comment

by:farzanj
ID: 35706904
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 31

Expert Comment

by:farzanj
ID: 35706923
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
 
LVL 31

Expert Comment

by:farzanj
ID: 35706961
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
 
LVL 12

Author Comment

by:Nathan Riley
ID: 35706988
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
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 800 total points
ID: 35707238
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
 
LVL 31

Expert Comment

by:farzanj
ID: 35707350
Do you know the IP addresses of both machines OR the domain names?  This info goes after @ sign in rsync or ssh syntax.
0
 
LVL 12

Author Comment

by:Nathan Riley
ID: 35707436
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
 
LVL 8

Accepted Solution

by:
eager earned 1000 total points
ID: 35712843
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
 
LVL 9

Assisted Solution

by:expert_tanmay
expert_tanmay earned 200 total points
ID: 35726118
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
 
LVL 8

Expert Comment

by:eager
ID: 35726548
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

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses
Course of the Month20 days, left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question