rsync and --fake-super - how to preserve attributes?

14,347

You are doing at least one thing wrong.

First of all you are using --fake-super on the wrong side of the connection. Let me quote the rsync man page.

The --fake-super option only affects the side where the option is used. To affect the remote side of a remote-shell connection, specify an rsync path:

rsync -av --rsync-path="rsync --fake-super" /src/ host:/dest/

What you are doing is running --fake-super on the side of the connection where you are already root anyway.

The part about "failed to write xattr user.rsync.%stat for" is because the file system used with --fake-super hasn't been mounted with the flag user_xattr. This mount option has to be in effect on the side of the connection where you are using --fake-super, which in your cause would be "remoteserver.com".

To summarize, these are the commands you should have been running:

# rsync -avz --rsync-path="rsync --fake-super" /var/www/myfolder [email protected]:/home/backups
# rsync -avz --rsync-path="rsync --fake-super" [email protected]:/home/backups/myfolder /tmp

...with the mount option user_xattr in effect on remoteserver.com

Share:
14,347

Related videos on Youtube

PeterB
Author by

PeterB

Updated on September 17, 2022

Comments

  • PeterB
    PeterB almost 2 years

    I have been trying to sort out my backups, so that when files are restored the owners/groups and any other metadata are correctly restored. For my testing I have been backing up from a Ubuntu 9.10 server (with rsync version 3.0.6, protocol version 30 installed) via ssh, to either an OSX 10.6 laptop or Ubuntu 9.10 server.

    Making the backup has been done using the following command (executed as root):

    # rsync -avz --fake-super /var/www/myfolder [email protected]:/home/backups
    

    No errors are reported when doing this.

    I then use the following to fetch back my test directory:

    # rsync -avz --fake-super [email protected]:/home/backups/myfolder /tmp
    

    And for every file it reports the error:

    rsync: failed to write xattr user.rsync.%stat for "/tmp/myfolder/path/to/file": Operation not supported (95)
    

    Originally I thought this must be because I was backing up to OSX, so I tried again backing up to a Ubuntu server - only to get the same error when restoring files. I have Googled and looked in the manpage for rsync, but found nothing of help.

    My local Ubuntu server uses ext3, the remote Ubuntu server ext4, and the Mac has HFS

  • evotopid
    evotopid about 8 years
    Note that at least as of rsync 3.1.2 (but probably already earlier versions) there is a --remote-option parameter which might generally be preferable. There is also the shortcut "-M" for it. So instead of --rsync-path="rsync --fake-super" one could also have written -M--fake-super.
  • Sparhawk
    Sparhawk about 8 years
    I can confirm that --remote-option aka -M is also in rsync 3.1.1.
  • Sean Leather
    Sean Leather about 7 years
    --remote-option/-M is not available in rsync 3.0.9 on CentOS 7.