LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-01-2009, 04:09 PM   #1
zardari7
LQ Newbie
 
Registered: Jul 2009
Posts: 11

Rep: Reputation: 0
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 !
 
Old 07-01-2009, 04:15 PM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,714
Blog Entries: 27

Rep: Reputation: 2057Reputation: 2057Reputation: 2057Reputation: 2057Reputation: 2057Reputation: 2057Reputation: 2057Reputation: 2057Reputation: 2057Reputation: 2057Reputation: 2057
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.
 
Old 07-01-2009, 04:22 PM   #3
arckane
Member
 
Registered: Sep 2005
Location: UK
Distribution: Gentoo/Debian/Ubuntu
Posts: 307

Rep: Reputation: 38
My preferred option is rsync.

'man rsync' then get ready for some good reading. Check the examples at the bottom
 
Old 07-01-2009, 04:40 PM   #4
zardari7
LQ Newbie
 
Registered: Jul 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for the swift replies.

Can u guyz please give some examples using those paths I mentioned in my first post
 
Old 07-01-2009, 04:57 PM   #5
RaelOM
Member
 
Registered: Dec 2004
Posts: 110

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


Something akin to that.
 
Old 07-01-2009, 05:31 PM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
A bit more specifically from server 1,
Code:
 rsync -av /home/website/folder/ root@server2:/home3/website/backup
 
Old 07-01-2009, 05:39 PM   #7
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,977
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by arckane View Post
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
 
Old 07-01-2009, 06:05 PM   #8
zardari7
LQ Newbie
 
Registered: Jul 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Hi all,

thanks a lot for the help!

I am using the rsync and it is copying the files over now!
 
Old 07-06-2009, 02:24 AM   #9
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Rep: Reputation: 75
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`

Last edited by micxz; 07-06-2009 at 02:32 AM. Reason: Add "in my opinion"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving a folder to a different partition Arituay Linux - Newbie 13 09-08-2007 06:59 PM
Moving my home folder. Lordandmaker Linux - Newbie 2 01-29-2006 02:08 PM
2 groups for complete access over to 1 share/folder ? amitsharma_26 Linux - General 5 12-16-2005 05:42 AM
Cursor problems when moving a Folder Riddick Linux - Software 0 08-27-2005 04:03 PM
Get complete folder with ftp sikandar Linux - Software 6 08-22-2003 10:41 PM


All times are GMT -5. The time now is 09:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration