LinuxQuestions.org
Visit Jeremy's Blog.
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 11-20-2007, 11:44 AM   #1
Yig
Member
 
Registered: Aug 2005
Location: Montreal, Qc
Distribution: CentOs 4.5/5.0
Posts: 113

Rep: Reputation: 15
Moving files between Linux boxes


I have an old server running Cent 4.5 that will be replaced by more modern hardware. I will also do a clean install of Cent 5 on it.

I also have a second Cent 5 box that will be used to host the files until the new server is up and running.

What is the best way to transfer files between Linux boxes?

Please note that amongst the files moved will be CVS repositories so I will need to preserve history.

Thanks!
 
Old 11-20-2007, 12:06 PM   #2
geek_man
Member
 
Registered: Nov 2007
Distribution: Fedora 7, Fedora 9, Solaris 10, Mac OS X, RHEL5
Posts: 71

Rep: Reputation: 15
Why wont you try NFS?

It is simple, though i am not sure about cvs, so i assume your CVS repos are under some file system after all, and you have network connection.

I would install/enable NFS services, then publish the filesystem or directory (eg. /home ) and then, on the backup machine mount that directory or filesystem and copy (eg. mount 192.xxx.xxx.xxx:/home /server_machine_mountpoint).

That would make a transparent transfer wich you can make in the opposite way once you have to restore your data.
 
Old 11-20-2007, 12:22 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
  • If you have physical access to the machines, and there are sufficient IDE/SCSI bus slots available, and don't mind doing it, one way is to rip the disk with all your data out of the original machine and install it in the new one. You can mount it in the place where you want to work, or if you prefer you can copy the files across. Using the cp command, you can use the -p option to preserve permissions and so on. Whether you copy or just use the old device, make sure the UIDs of the file owners/groups are the same on the old and new systems
  • Over a network you could use rsync. You just have to be able to ssh from one machine to the other. To preserve ownership of files and the like you'll need to be ssh to root on the destination machine.
  • An alternative to rsync is scp, which is probably more likely to be installed by default.
 
Old 11-20-2007, 07:55 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
iirc, ssh is an option in rsync, not requirement. Otherwise I agree with matthewg42.
BTW geek_man, NFS makes files avail, but does not move them, so they'd get trashed when the old system was rebuilt.
 
Old 11-21-2007, 10:45 AM   #5
Yig
Member
 
Registered: Aug 2005
Location: Montreal, Qc
Distribution: CentOs 4.5/5.0
Posts: 113

Original Poster
Rep: Reputation: 15
Let's see I make the folder /oldstuff on box2 and I want to copy a few folders on box1 I'd use the following:

rsync -avz box2:/usr/local/repo1 /oldstuff/repo1

So if I got this right, using -avz will copy recursively everything in repo1 to repo1 on box2.

That's it?
 
Old 11-21-2007, 10:54 AM   #6
jphilput
Member
 
Registered: Nov 2007
Posts: 58

Rep: Reputation: 15
The options are correct, but the order my not be. If you want to copy the host machine's /oldstuff/repo1 to the same path on box2, the command would be:

rsync -avz /oldstuff/repo1 box2:/usr/local/repo1

rsync expects the source to be first, and the dest to be second.

Last edited by jphilput; 11-21-2007 at 10:55 AM.
 
Old 11-21-2007, 12:25 PM   #7
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Quote:
Originally Posted by chrism01 View Post
iirc, ssh is an option in rsync, not requirement. Otherwise I agree with matthewg42.
BTW geek_man, NFS makes files avail, but does not move them, so they'd get trashed when the old system was rebuilt.
Oops, you're right. It is possible to use rsh, remsh or other remote shells. Using rsh might actually be quicker if you have a fast network, as ssh can max out the CPU going the encryption/decryption if the throughput is very high.

I've successfully indoctrinated myself into considering rsh and friends "not an option" for security reasons... You're right though, and there are cases when it is better in some ways than ssh. Even so, the "don't use rsh, use ssh" mantra should still be repeated at every opportunity.
 
Old 11-21-2007, 02:58 PM   #8
Yig
Member
 
Registered: Aug 2005
Location: Montreal, Qc
Distribution: CentOs 4.5/5.0
Posts: 113

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jphilput View Post
The options are correct, but the order my not be. If you want to copy the host machine's /oldstuff/repo1 to the same path on box2, the command would be:

rsync -avz /oldstuff/repo1 box2:/usr/local/repo1

rsync expects the source to be first, and the dest to be second.
Yeah, I noticed when I tried that I had to reverse the order.

And it preserved my CVS history.

Look like that did the job!

Thanks everybody!
 
Old 11-21-2007, 07:16 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
I usually mention the ssh option, but wouldn't want people to believe that they HAVE to install/use ssh for rsync.
For internal txfrs, esp one-offs like this, I'd say it's overkill (probably)...
 
  


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
sharing network files between Linux boxes linuxhippy Slackware 23 04-22-2005 08:03 PM
moving users acct between boxes (RH9 to SuSE 9.1) ToBe Linux - Software 4 10-28-2004 02:59 PM
what's the best way to swap files between directly connected linux and windows boxes? Lechium Linux - Networking 1 08-01-2004 02:47 PM
Backing up files on Windows boxes to Linux thosm Linux - Software 1 04-08-2004 07:36 PM
how to share linux files on LAN btwn other linux boxes shakeeb Linux - Networking 9 02-04-2004 03:10 PM


All times are GMT -5. The time now is 01:55 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