rsync和–fake-super – 如何保留属性?

我一直在尝试整理我的备份,以便在恢复文件时,所有者/组和其他任何元数据都可以正确恢复。 对于我的testing,我已经通过ssh从Ubuntu 9.10服务器(rsync版本3.0.6,协议版本30安装)备份到OSX 10.6笔记本电脑或Ubuntu 9.10服务器。

使用以下命令(以root身份执行)完成备份:

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

这样做没有错误报告。

然后,我使用以下来取回我的testing目录:

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

并为每个文件报告错误:

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

最初我以为这一定是因为我备份到OSX,所以我再次尝试备份到Ubuntu服务器 – 只有在恢复文件时得到相同的错误。 我已经谷歌search,看在rsync的manpage,但没有find任何帮助。

我的本地Ubuntu服务器使用ext3,远程Ubuntu服务器ext4,而Mac有HFS

你至less做错了一件事。

首先,你在连接的错误一面使用–fake-super。 让我引用rsync手册页。

–fake-super选项只影响选项的使用方。 要影响远程shell连接的远程端,请指定一个rsyncpath:

rsync -av –rsync-path =“rsync -fake-super”/ src / host:/ dest /

你正在做的是在你已经是root的连接的那一边运行–fake-super。

关于“无法写入xattr user.rsync。%stat”的部分是因为与–fake-super一起使用的文件系统没有使用标志user_xattr挂载。 这个安装选项必须在你使用的–fake-super连接的一侧生效,这在你的原因是“remoteserver.com”。

总而言之,这些是你应该运行的命令:

 # 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 

…在remoteserver.com上使用挂载选项user_xattr