Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Rsync doesn't copy everyting

  1. #1
    Join Date
    Feb 2008
    Location
    Belgium
    Beans
    53
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Rsync doesn't copy everyting

    Hi all,

    I'm having some trouble with rsync. I'm trying to sync my local /etc directory to a remote server, but this won't work.

    The problem is that it seems he doesn't copy all the files.
    The local /etc dir contains 15MB of data, after a rsync, the remote backup contains only 4.6MB of data.

    Rsync is running by root. I'm using this command:

    Code:
    rsync --rsync-path="sudo rsync" -e "ssh -i /root/.ssh/backup" -avz --delete --delete-excluded -h --stats /etc kris@192.168.1.3:/home/kris/backup/laptopkris
    I hope someone can help.
    Thanks!

    Kris

  2. #2
    Join Date
    Feb 2008
    Location
    Belgium
    Beans
    53
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Rsync doesn't copy everyting

    I found that if I do a local sync, everything goes fine.
    But if I do a remote sync, it copies only 4.6MB.

    Any idea?

  3. #3
    Join Date
    Sep 2007
    Location
    Rivendell
    Beans
    487
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Rsync doesn't copy everyting

    never used rsync on a remote machine, but "sudo rsync" looks wrong. you probably can't call sudo like that so the ssh connection needs to have the proper privileges for executing rsync.

    just an educated guess, though.
    True warriors don't follow paths - they make them.
    It's not their desire, it's their nature.

  4. #4
    Join Date
    Feb 2008
    Location
    Belgium
    Beans
    53
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Rsync doesn't copy everyting

    Thanks for your answer.

    In /etc/sudoers I have added next line, so "sudo rsync" will work.
    Code:
    kris ALL=NOPASSWD: /usr/bin/rsync
    I also tried without --rsync-path="sudo rsync", but without success.

    I have also tried on the server to pull the files from the laptop, but that doesn't work either.

  5. #5
    Join Date
    Sep 2007
    Location
    Rivendell
    Beans
    487
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Rsync doesn't copy everyting

    in the rsync help file it says that --rsync-path is for the path to rsync on the remote machine, so my guess is that you can't use sudo there as it will be interpreted as a path.

    so you will have to do --rsync-path="/path/to/rsync" and make sure the ssh login has root privileges if you need them to access the files you want to sync.

    --rsync-path="sudo rsync" probably fails because
    a) sudo is interpreted as a path
    b) the space isn't escaped
    c) sudo probably won't allow itself to be called remotely

    again, this is not more than an educated guess.
    True warriors don't follow paths - they make them.
    It's not their desire, it's their nature.

  6. #6
    Join Date
    Feb 2008
    Location
    Belgium
    Beans
    53
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Rsync doesn't copy everyting

    I understand what you mean, so I tried also:

    Code:
    rsync -Cavuhzb --rsync-path="/usr/bin/rsync" -e "ssh -i /root/.ssh/backup" /etc kris@192.168.1.3:/home/kris/backup/laptopkris
    Then I get this error:
    sending incremental file list
    rsync: recv_generator: failed to stat "/home/kris/backup/laptopkris/etc/chatscripts/pap": Permission denied (13)
    rsync: recv_generator: failed to stat "/home/kris/backup/laptopkris/etc/chatscripts/provider": Permission denied (13)
    rsync: symlink "/home/kris/backup/laptopkris/etc/cups/ssl/server.crt" -> "/etc/ssl/certs/ssl-cert-snakeoil.pem" failed: Permission denied (13)
    rsync: symlink "/home/kris/backup/laptopkris/etc/cups/ssl/server.key" -> "/etc/ssl/private/ssl-cert-snakeoil.key" failed: Permission denied (13)
    rsync: recv_generator: failed to stat "/home/kris/backup/laptopkris/etc/ppp/peers/provider": Permission denied (13)
    rsync: recv_generator: failed to stat "/home/kris/backup/laptopkris/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied (13)

    sent 86.85K bytes received 306 bytes 174.31K bytes/sec
    total size is 8.71M speedup is 99.97
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1058) [sender=3.0.5]

    And the same command with "root" instead of "kris".
    Then, I get no errors, but I still don't have all the files synced.

  7. #7
    Join Date
    Feb 2008
    Location
    Belgium
    Beans
    53
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Rsync doesn't copy everyting

    Sorry for this bump.
    I'm still having the same problem.

    Any idea?

    Thanks.

  8. #8
    Join Date
    Feb 2009
    Location
    in a bit register
    Beans
    79
    Distro
    Ubuntu Development Release

    Re: Rsync doesn't copy everyting

    Quote Originally Posted by Scormen View Post
    I understand what you mean, so I tried also:

    Code:
    rsync -Cavuhzb --rsync-path="/usr/bin/rsync" -e "ssh -i /root/.ssh/backup" /etc kris@192.168.1.3:/home/kris/backup/laptopkris
    Then I get this error:



    And the same command with "root" instead of "kris".
    Then, I get no errors, but I still don't have all the files synced.
    Maybe there's a nicer way but you could place /usr/bin/rsync into a private protected area and set the owner to root place the sticky bit on it and change your rsync-path argument such like:

    Code:
    # on the remote side, aka kris@192.168.1.3
    mkdir priv-area
    # protect it from normal users running a priv version of rsync
    chmod 700 priv-area
    cd priv-area
    cp -p /usr/local/bin/rsync ./rsync-priv
    sudo chown 0:0 ./rsync-priv
    sudo chmod +s ./rsync-priv
    ls -ltra # rsync-priv should now be 'bold-red' in bash

    Looking at your flags, you've specified a cvs ignore factor, ignore files that are updated on the target, and you're specifying a backup of removed files.

    Code:
    rsync -Cavuhzb --rsync-path="/home/kris/priv-area/rsync-priv" -e "ssh -i /root/.ssh/backup" /etc kris@192.168.1.3:/home/kris/backup/laptopkris

    From those qualifiers you're not going to be getting everything sync'd. It's doing what you're telling it to do.


    If you really wanted to perform a like for like backup.. (not keeping stuff that's been changed/deleted from the source. I'd go for something like the following.

    Code:
     rsync --archive --delete --hard-links --one-file-system --acls --xattrs --dry-run -i --rsync-path="/home/kris/priv-area/rsync-priv" --rsh="ssh -i /root/.ssh/backup" /etc/ kris@192.168.1.3:/home/kris/backup/laptopkris/etc/
    Remove the --dry-run and -i when you're happy with the output, and it should do what you want. A word of warning, I get a bit nervous when not seeing trailing (/) on directories as it could lead to all sorts of funnies if you end up using rsync on softlinks.
    10 things about binary you should know.
    Some people get it - the rest don't.

  9. #9
    Join Date
    Feb 2008
    Location
    Belgium
    Beans
    53
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Rsync doesn't copy everyting

    Thanks for your help, binary10.

    I've tried what you have said, but still, I only receive 4.6MB on the remote server.
    Thanks for the warning, I'll not that!

    Did someone already tried to rsync their own /etc to a remote system? Just to know if this strange thing only happens to me...

    Thanks.

  10. #10
    Join Date
    Feb 2009
    Location
    in a bit register
    Beans
    79
    Distro
    Ubuntu Development Release

    Re: Rsync doesn't copy everyting

    Quote Originally Posted by Scormen View Post
    Thanks for your help, binary10.

    I've tried what you have said, but still, I only receive 4.6MB on the remote server.
    Thanks for the warning, I'll not that!

    Did someone already tried to rsync their own /etc to a remote system? Just to know if this strange thing only happens to me...

    Thanks.
    Ok so I've gone back and looked at your original post, how are you calculating 15MB of data under etc - via a du -hsx /etc/ ??


    I do daily drive to drive backup copies via rsync and drive to network copies.. and have used them recently for restoring.


    Sure my du -hsx /etc/ reports 17MB of data of which 10MB gets transferred via an rsync. My backup drives still operate.

    rsync 3.0.6 has some fixes to do with ACLs and special devices rsyncing between solaris. but I think 3.0.5 is still ok with ubuntu to ubuntu systems.

    Here is my test doing exactly what you you're probably trying to do. I even check the remote end..

    Code:
    binary10@jsecx25:~/bin-priv$ ./rsync --archive --delete --hard-links --one-file-system --stats --acls --xattrs --human-readable --rsync-path="~/bin/rsync-priv-os-specific" --rsh="ssh" /etc/ rsyncbck@10.0.0.21:/home/kris/backup/laptopkris/etc/
    
    Number of files: 3121
    Number of files transferred: 1812
    Total file size: 10.04M bytes
    Total transferred file size: 10.00M bytes
    Literal data: 10.00M bytes
    Matched data: 0 bytes
    File list size: 109.26K
    File list generation time: 0.002 seconds
    File list transfer time: 0.000 seconds
    Total bytes sent: 10.20M
    Total bytes received: 38.70K
    
    sent 10.20M bytes  received 38.70K bytes  4.09M bytes/sec
    total size is 10.04M  speedup is 0.98
    
    binary10@jsecx25:~/bin-priv$ sudo du -hsx /etc/
    17M	/etc/
    binary10@jsecx25:~/bin-priv$
    And then on the remote system I do the du -hsx

    Code:
    binary10@lenovo-n200:/home/kris/backup/laptopkris/etc$ cd ..
    binary10@lenovo-n200:/home/kris/backup/laptopkris$ sudo du -hsx etc
    17M	etc
    binary10@lenovo-n200:/home/kris/backup/laptopkris$
    10 things about binary you should know.
    Some people get it - the rest don't.

Page 1 of 3 123 LastLast

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
  •