Transfer Files from one LAMP Machine to Another

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?
Paul KonstanskiProject SpecialistAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent WSr. Network / Systems AdminCommented:
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
GaryCommented:
You could always just tar the files, put them in a public directory and wget the file on the other server.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Paul KonstanskiProject SpecialistAuthor Commented:
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
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

GaryCommented:
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
omarfaridCommented:
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
Kent WSr. Network / Systems AdminCommented:
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
GaryCommented:
You just repeated exactly what I said.
0
Kent WSr. Network / Systems AdminCommented:
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
Gerwin Jansen, EE MVETopic Advisor Commented:
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
Paul KonstanskiProject SpecialistAuthor Commented:
Good answer. Hard to pick any one as best since they all add to it.  Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.