googling like mad, still clueless re network copying
I've got two Linux machines, a Pentium III/245 MB RAM with Ubuntu 7.10 and Amarok, and an Athlon 64 dual core 3800/ 1 GB RAM with Ubuntu 8.04 and Amarok and lots of other stuff. I also have a Windows XP machine with an Athlon 64 3700 single core and 1.5 GB RAM.
All three machines are networked together via a simple wired ethernet router. Only the two Linux machines will be interacting with one another. The Windows machine is just on the router for the purpose of getting the Internet.
I need to figure out how to copy files from one Linux machine to the other. My googling and question asking tells me I should probably use Rsync and that there's even a nice GUI for it available.
I want to know how to do this in the GUI and at the command line. However, I'm so clueless to Linux networking, I don't know where to begin to figure out how to identify a drive on the other machine and how to make sure I have permissions to copy to it. (Do I need to CHOWN it?)
I've worked with the command line in DOS for many years. With it, it would be something like:
The goal is to eventually be set up so that on the Athlon Linux machine, I can just double click an icon to copy over all the Amarok database files and MP3s (that have changed since the last copy) and edit them on the faster machine. Then when I'm done, I can click on another icon to copy all the changed files back to the Pentium III Linux machine.
Edit: The GUI I intend to use for RSync is this one: http://www.opbyte.it/grsync/
If you only copy single files, just install 'ssh'. You can use the 'scp' tool to do remote copies.
If you want to copy entire directories, then rsync is probably the tool you want. Come to think of it, looking at your post, it is just the tool you want. What GUI are you thinking of using for rsync? I've tried a few and dumped them all because I considered them severely defective. You just have to experiment a little until you understand the 'rsync' manual and then maybe make some small shell scripts with notes and showing you the most common ways that you invoke rsync.
rsync can copy any remote file which you have access to. Since you need to specify a user, the home directory will be that user's home directory, but if you don't like that, you can always specify a full path from the root directory.
Just be extremely careful - what you are describing makes it easy to revert to your old files if you accidentally click on the wrong icon. You will want to make test directories and make dummy files just to make sure that you get the rsync options right so that they will not accidentally overwrite a newer file. If you do need to revert a file, that is probably best done by making a copy via 'scp', manually checking md5 sums, and then copying that file over the file to be reverted. Big hassle, but it's the safest way. To be a little safer, make sure you have backups. :)
Also make sure your machines run NTP so that the times don't go out of sync and do - uh - 'interesting' things to your file transfer scripts.
I'm not using an RSync GUI yet, but the one I'm planning to use is this one: http://www.opbyte.it/grsync/
You're absolutely right about practicing on test files and directories first. Gonna do that for certain. And even after I've tested anything, I'm not running these commands until AFTER I've backed everything up to an external hard drive. That drive is already hooked up to my Pentium III juke box, and I'm already regularly back up to it.
What's stumping me is how to identify a drive on the other computer. How do I know its designation. Linux doesn't use the letter designations that I'm familiar with from DOS/Windows.
To expand a bit on pinniped's response, there are two general flavors to copying files across a network. One case is generally referred to as a 'file transfer' and implies that there is a pair of cooperating programs on each of the two hosts, and the user specifies what file(s) should be copied from where to where. scp is the most commonly used of this flavor these days. The other flavor of file transfer, involves the two or more hosts sharing their filesystems using a cooperating protocol, so that one hosts filesystem includes some or all of the files that are physically located on another host. Once this is set up, all programs that access files will be able to use the networked files transparently. With all due respect to pinniped, rsync is not intended to be a general purpose file copying utility, as much as a system backup tool. I suppose it can be used as a copying tool, but other tools are probably more suited to the job.
Which type of copying you want to do depends on your scenario. For small, quick ad hoc jobs, a file transfer style of copying works best. Most modern Linux hosts come with ssh all set up and ready to go. Use the man page for scp to get the details. There are GUI tools that can do some hand-holding for you.
Setting up network file sharing is more complex and will require configuring parts on each host involved. Once done, copying files is a seamless as your DOS copy command example. Filesystem sharing is primarily done with NFS &/or SMB/CIFS. If Windows is going to be one of the hosts, it will be SMB/CIFS, and the Samba package on Linux.
Tell us more about your intentions, and we can offer more detailed advice.
the ~/.kde/share/apps/amarok/ directory &
the ~/.kde/share/config/amarokrc file.
The MP3 files are in home/tom/music (and several sub-folders to that)
The simpler of the two copying needs, the one not involving the network, I'm already getting done via the built-in file manager. I'm just copying all those files to a 120 GB external hard drive. I'm getting it done with the file manager, but it's a little awkward. I want to set up something that's so simple to use that I'll use it without hesitation. If I were working on a Windows machine, the program I would use is Second Copy (www.secondcopy.com). In fact, Second Copy is so vital to my Windows machine, I credit it for saving my butt yesterday when my Windows PC's hard drive crashed. Because of Second Copy (and Acronis True Image) I didn't lose so much as an e-mail or a browser bookmark. With SC, you set up profiles that contain info on exactly what files and folders you want copied whenever you run that particular profile. I want to do the same thing in Linux. I click on the profile to backup the Amarok data, and Amarok's database, config file, and all the MP3s get copied over – well, all the ones that have changed since the last backup anyway. I tried the Keep backup utility, but didn't like it. I want something that simply copies the files over without modifying the format.
My other copy needs are to copy that same data as above from the Pentium III Linux workstation to the Athlon Linux workstation. Again, it only need copy those files that have changed. As you would expect, my Athlon Linux machine performs much better than the Pentium III machine. For that reason, plus the fact that it's more comfortably located in my office, I want to do all my editing of my music collection on that machine. The Pentium III is in the living room and is hooked up to my home entertainment center. It's the machine I'm using to actually play all the music.
I don't need to copy any files over the network to or from my Windows PC. I sits right next to my Athlon Linux machine. If I need to copy anything from it, I'll just sneakernet it with a thumb drive.
So typically, it will work as follows:
1. Copy all changed files from the Pentium III Linux machine via USB cable to its external hard drive.
2. Copy all changed files from the Pentium III via the network to the Athlon Linux machine and into the directories where they need to be for Amarok to run correctly.
3. Edit the music collection on the Athlon machine.
4. Copy all changed files back to the Pentium III into the locations where they need to be for Amarok to run correctly.
That's it. That's what I'm doing.
If you're copying a directory, and need to do it on-the-fly, you can always use tar and ssh/rsh
This can be reversed (and you can use rsh if you don't have ssh and rsh is allowed on your net):
machine a to machine b - assuming machine a has the files you want to copy to b
tar cpf - ~/.kde/share/apps/amarok/|ssh b "cd /dir/you/want/to/extract/to;tar xvpf -"
machine b from machine a
ssh b "tar cpf - ~/.kde/share/apps/amarok/"|(cd /dir/you/want/to/extract/to; tar xvpf -"
If you want to do it regulary, the above suggestions are probably more appropriate :)
In that case, rsync might actually be the most appropriate tool. Here's some pointers on using scp (secure copy). For starters, make sure it is set up. Try copying any old file from one machine to another:
If that works, you can add a '-r' to the scp command and use a directory name as the source. It will then recursively copy all of the files in all of the subdirectories from the source to the destination. You can put the command into a shell script, so it can be invoked easily, or possibly run automatically on a scheduled basis using cron. If you do that, you will want to set up shared keys for passwordless connection. Since you want to copy only changed files, you can use find to locate files that have been modified in the last interval:
Use the result as the list of files to secure copy:
I should also mention that the copying can go in either direction, initiated from either the source host or the target host. So all of your scripting can be consolidated in one place, if you chose to use such a method.
Hope this helps.
|All times are GMT -5. The time now is 07:58 PM.|