LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Moving a complete folder to another linux server (https://www.linuxquestions.org/questions/linux-newbie-8/moving-a-complete-folder-to-another-linux-server-737028/)

zardari7 07-01-2009 04:09 PM

Moving a complete folder to another linux server
 
I am running centos on both servers.

I have a folder with 20gb of files and data, that folder has subfolders too.

like in /home/website/folder/

I want to move that folder to another server (running centos there too).

I have the root login and pw to both servers.

I believe there should be a command so I can move the folder over to the other server?

so basically here are the paths:

server1

/home/website/folder

server 2
/home3/website/backup/


I want to move folder over to server 2 in the backup folder.


Thanks !

onebuck 07-01-2009 04:15 PM

Hi,

Welcome to LQ!

Look at 'scp';

Quote:

excerpt from 'man scp';

scp - secure copy (remote file copy program)
SYNOPSIS
scp -words [-1246BCpqrv ] [-c cipher ] [-F ssh_config ] [-i identity_file ] [-l limit ] [-o ssh_option ] [-P port ] [-S program ] [[user @ ] host1 : file1 ] [... ] [[user @ ] host2 : file2 ]
DESCRIPTION
scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1). Unlike rcp(1), scp will ask for passwords or passphrases if they are needed for authentication.

Any file name may contain a host and user specification to indicate that the file is to be copied to/from that host. Copies between two remote hosts are permitted.

arckane 07-01-2009 04:22 PM

My preferred option is rsync.

'man rsync' then get ready for some good reading. Check the examples at the bottom :)

zardari7 07-01-2009 04:40 PM

Thanks for the swift replies.

Can u guyz please give some examples using those paths I mentioned in my first post

RaelOM 07-01-2009 04:57 PM

rsync -vaz -rsh=ssh <souce directory> root@<hostname>:<Target directory>


Something akin to that.

billymayday 07-01-2009 05:31 PM

A bit more specifically from server 1,
Code:

rsync -av /home/website/folder/ root@server2:/home3/website/backup

custangro 07-01-2009 05:39 PM

Quote:

Originally Posted by arckane (Post 3593412)
My preferred option is rsync.

'man rsync' then get ready for some good reading. Check the examples at the bottom :)

I prefer rsync as well since it preserves permissions and such...

-C

zardari7 07-01-2009 06:05 PM

Hi all,

thanks a lot for the help!

I am using the rsync and it is copying the files over now!

micxz 07-06-2009 02:24 AM

I know this post is solved I would like to add to it for future viewers.

If you would like to move a large number of files the best way (in my opinion) would be to use tar over ssh as tar is faster than rsync when no files exist in the destination. Then after the initial copy then use rsync to grab whatever files have changed as it is faster then tar when there are only a few differences in the file systems.

Example:
Code:

tar zcf - folder/ | ssh user@server "cd /path/to/dest/; tar zpxvf -"
Then you get a nice copy of "folder" inside the folder "dest" on "server".

Then use rsync as suggested above to keep the file systems in `sync`


All times are GMT -5. The time now is 10:33 PM.