5

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 backupuser@remoteserver.com:/home/backups

No errors are reported when doing this.

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

# rsync -avz --fake-super backupuser@remoteserver.com:/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

PeterB
  • 609
  • 1
  • 7
  • 13

1 Answers1

15

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 backupuser@remoteserver.com:/home/backups
# rsync -avz --rsync-path="rsync --fake-super" backupuser@remoteserver.com:/home/backups/myfolder /tmp

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

andol
  • 6,848
  • 28
  • 43
  • 4
    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`. – evotopid Apr 30 '16 at 20:24
  • 1
    I can confirm that `--remote-option` aka `-M` is also in rsync 3.1.1. – Sparhawk May 25 '16 at 06:26
  • 1
    `--remote-option`/`-M` is not available in rsync 3.0.9 on CentOS 7. – Sean Leather May 19 '17 at 09:58