Solved

Transfer Files from one LAMP Machine to Another

Posted on 2014-12-18
10
177 Views
Last Modified: 2014-12-20
I have two LAMP server and I need to transfer a whole directory structure from Machine A to Machine B.

I have telnet root access to both machines.

For most projects I'm working on I just use FTP and download files to my local drive and then upload to the new server via FTP.

But this particular application has nearly 25GB of files to transfer and I would like to simply go straight from server to server.

Is there a simple way to do that from from within the shell access?
0
Comment
Question by:pkonstan1
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 12

Assisted Solution

by:Kent W
Kent W earned 150 total points
ID: 40507849
You most likely have ssh, not telnet access.  

If you are transferring files, I would recommend rsync.  It pipes through ssh nicely, so all you need to do is something like

rsync -avz -e ssh /var/www/html/ server.domain.com:/var/www/html/

For this example, I'm assuming you want to transfer /var/www/html/ to the new machine.
-e ssh tells rsync to pipe through ssh (what you are probably referring to as "telnet").

All you need to do upon running the command is give the root pass / user when prompted.
"server.domain.com" is your receiving server.

Do NOT try to transfer / (your whole directory structure). Just transfer the files / config files you actually need to migrate.  If you transfer things like /dev /proc, etc. you will hose the receiving box.
0
 
LVL 58

Accepted Solution

by:
Gary earned 200 total points
ID: 40507872
You could always just tar the files, put them in a public directory and wget the file on the other server.
0
 

Author Comment

by:pkonstan1
ID: 40507904
I just realized that I don't have root SSH access on the receiving machine, so I'll have to do the tar option.

Can you give me a sample of how those commands would work?

I'm only moving over a bunch of audio files. It could be as much as 25GB and 1000 files. Will that work via TAR?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40507920
Depending the server setup you may be able to do a server to server transfer in your FTP program

tar just packs the files into one file that you can then untar when transferred - easier than copying each file individually.

tar -zcvf target_name.tar.gz folder_to_tar
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 75 total points
ID: 40507937
is ftp open between the two servers?

you can always schedule crontab job to tar the files and then transfer to the other server via ftp and on the remote server untar files.

if you could have ssh between the two systems allowed then you could schedule scp via crontab to copy folders between the two.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 12

Expert Comment

by:Kent W
ID: 40508018
Also, if you have a web server running on the first machine, you can place the .tar in a web directory and use wget from the new machine to download.

wget http://first.machine.com/directory/file.tar.gz

It will be downloaded to the directory from which you issue the command.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40508032
You just repeated exactly what I said.
0
 
LVL 12

Expert Comment

by:Kent W
ID: 40508043
Oops.  Didn't see that Gary, my apologies.

Oh, I see, I saw his request for how go use wget.  That's more of the lines of what I was answering.  The actual command, which OP asked.  I think after that was where you addressed the ftp how-to, and actual unzipping.
0
 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 75 total points
ID: 40510785
You would not need root access for copying files from one system to another, just a user that can logon (ssh) that has write access to the destination folder.

You can use tar on one server to create the archive directly to stdout, then send that to tar on the other machine to write output to the destination.

Like this:

(on source system)

tar cfz - /source/path | ssh user@destinationhost tar xfz - -C /destination

Open in new window


In the example above path is your source folder with the audio files, the command above will create that same folder as a subfolder of /destination. z option is compressing data as it is being transferred.
0
 

Author Closing Comment

by:pkonstan1
ID: 40511329
Good answer. Hard to pick any one as best since they all add to it.  Thanks.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now