Results 1 to 7 of 7

Thread: Commands to Copy/Paste files from one server to another

  1. #1
    Join Date
    Mar 2010
    Posts
    66

    Commands to Copy/Paste files from one server to another

    I have two SME 7.5.1 server (say A and B). One of them have been in production for 2 / 3 days apart, I replaced A by B with affa (rise), but now I'm back in A production then removing B. There's really not had much like changed or added files (and nothing changed in config or users)

    I thought so just copy/paste the incremental
    /Home/e-smith/files to copy only
    - Changed files AND
    - The New Files
    - It's mail server, then also copy the emails.

    Say
    A by 10.0.128.15
    B by 10.0.128.200

    What would be the correct command please?

  2. #2
    Join Date
    Nov 2008
    Posts
    1,066

    Re: Commands to Copy/Paste files from one server to another

    You have not provided any information on the way this "copy and paste could be done: via USB, samba, nfs, hard physical transfer, other?

    Also we don't have any information either on your wish to copy only new files or changed: it is a real need (large volume, slow connection, other?) or simply a desire not to copy what is useless?

    No information, finally, on the way you access servers: the console, either locally through ssh, winscp or by smbfs, remotely via VPN or other means?

    Indeed, according to these criteria we do not, the answer will inevitably vary much! Depending on circumstances, it may ultimately be advantageous to copy everything, or rather, it is absolutely limited to the essentials. So, as applicable, use cp or rsync... But we must first establish a connection between two servers, a connection that probably will not be the same as they are side by side or separated by a few thousands of km (or even only a few tens of meters)

    Personally, I often transfer data from one SME to another, and rarely I use the same method: I selected the one that seems most simple to implement, while respecting the requirements according to each specific case. These range from removing the source disc and install on the target server under temporary smbfs mounts on a client passing of course through direct rsync between the two servers.

    Well, that said, some still manage to make the same manner and give you perhaps the commands they use... Personally, I can not choose when I do not have all the elements.

  3. #3
    Join Date
    Mar 2010
    Posts
    66

    Re: Commands to Copy/Paste files from one server to another

    Sorry for this obvious lack of accuracy, I realized after the fact, and therefore the time loss!

    In fact the 2 servers are in the same LAN, same physical Local Ssh access are functional in 2 directions (and even from home I can access the server via ssh prod)

    The goal is to have a sort of 'sync' A and B before A in the back without having to prod in the back 'affa' because there is very little difference between the 2 since B has turned that 3 / 4 days when it replaced A.

  4. #4
    Join Date
    Nov 2008
    Posts
    1,066

    Re: Commands to Copy/Paste files from one server to another

    In this case, you can use rsync which will connect via ssh on the remote server and copy only new and changed files. This is from the server a command such as B (WARNING: to adapt to your specific case, see, among other options, and directories as required. man rsync for more info)

    Code:
    rsync -a --del -p --progress /home/e-smith/ root@server.A:22/home/e-smith/
    I do not take the folder files/emails to get too, you could also do with a set of include/exclude. To see if you do not also need to synchronize / root and / etc. I specified the port, but it has not been changed it is not mandatory.

    You can run rsync as a first step by adding the -n option: it will tell you what it will copy, without actually performing. A good idea to ensure you have properly completed all the right parameters.

  5. #5
    Join Date
    Mar 2010
    Posts
    66

    Re: Commands to Copy/Paste files from one server to another

    Thank you for your help. One thing concerns me, looking at the man and the rsync command you suggest:

    1) In your command I do not see any option that seems like the incremental I want: that new files and modified files?
    2) The -del does it mean that it will delete files on source after making the copy?

    And why not we use the

    -U, - update skip files in the most recent recipient

    Is it useless in this case?

  6. #6
    Join Date
    Nov 2008
    Posts
    1,066

    Re: Commands to Copy/Paste files from one server to another

    The operation is the normal incremental of rsync. This is where it interests!

    - delete-during, - del
    With this option, deleting files on the receiving side is performed incrementally during the transfer. This is a faster method than before or after the transfer, but it is only supported since version 2.6.4 of rsync. Refer to - delete (which is selected implicitly) for more information.

    Do not forget the -n option that allows you to see what would happen without actually doing it. It is so easy and absolutely safe to do some experiments if what supposed to do this or that option does not seem clear to you

    I told you that the command given was to adapt to your particular case: it was more an example of the command to copy paste!

    Well, I think you realized as you study the options for rsync. But you only really know which ones to use! For "-u", I do not know: basically, no, if the case is exactly as you describe. What makes me doubt, is precisely that you ask yourself the question... Is there a possibility that files are more recent than A to B? Such as you describe things, no. Of course, if there was anything actually on the rise of A after B, it is possible (without being certain). After that everything depends on which version you want to keep. With "-u", you will keep the newer version of A, without "-u" you have a copy of the older version of B.

  7. #7
    Join Date
    Mar 2010
    Posts
    66

    Re: Commands to Copy/Paste files from one server to another

    Thank you again for your patience. In fact the "-u" implies that rsync is natively 'incremental'. And as you understand it, in fact, the "-u" in my setup is useless because nothing was touched on A). With the "-n" I have a list of files scrolling and end of simulation:

    Code:
    sent 3036029 bytes received 285577 bytes 29009.66 bytes/sec
    total size is 76903429079 speedup is 23152.48 (DRY RUN)
    [root@server-linux /]#
    when I remove the -n error here:

    Code:
    [root@server-linux /]# rsync -a --del -p --progress /home/e-smith/ root@10.0.128.200:22/home/e-smith/
    sending incremental file list
    rsync: writefd_unbuffered failed to write 4092 bytes to socket [sender]: Broken pipe (32)
    rsync: mkdir "/root/22/home/e-smith" failed: No such file or directory (2)
    rsync error: error in file IO (code 11) at main.c(577) [Receiver=3.0.7]
    rsync: connection unexpectedly closed (9 bytes received so far) [sender]
    rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]
    [root@server-linux /]#
    I tested it with a copy B to B, then I created test:

    Code:
    rsync -a --del -p --progress /home/e-smith/ /test/
    And then it works.

Similar Threads

  1. Replies: 4
    Last Post: 17-05-2012, 06:37 AM
  2. Not able to Copy Paste Music files from DvdRW
    By pauldjdom in forum Media Player
    Replies: 2
    Last Post: 21-04-2012, 08:40 PM
  3. Excel file corrupted because of copy paste between files
    By RopeME in forum MS Office Support
    Replies: 2
    Last Post: 25-01-2012, 04:52 PM
  4. Problem copy and paste files to DVD
    By nooob in forum Windows Software
    Replies: 5
    Last Post: 17-01-2010, 03:04 AM
  5. Copy / paste big files in windows 7
    By TyReal in forum Operating Systems
    Replies: 3
    Last Post: 11-05-2009, 10:45 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,897,940.01807 seconds with 17 queries