![我的 rsync 是否成功备份了所有数据?](https://linux22.com/image/730313/%E6%88%91%E7%9A%84%20rsync%20%E6%98%AF%E5%90%A6%E6%88%90%E5%8A%9F%E5%A4%87%E4%BB%BD%E4%BA%86%E6%89%80%E6%9C%89%E6%95%B0%E6%8D%AE%EF%BC%9F.png)
看起来 rsync 之后没有丢失任何字节,但是存在一些错误:
ujjain@DS3018xs:/volume1$ cat rsync.sh
rsync -av photo.tar /var/services/homes/ujjain/nfs/RAIDF1/
rsync -av music.tar /var/services/homes/ujjain/nfs/RAIDF1/
ujjain@nas:/volume2/Files/RAIDF1$ ls -al
total 418910340
drwxrwxrwx+ 1 admin users 36 Nov 29 22:54 .
drwxrwxrwx+ 1 ujjain users 410 Nov 29 21:47 ..
-rw------- 1 admin users 53127639040 Nov 29 20:52 music.tar
-rw------- 1 admin users 375836549120 Nov 29 20:50 photo.tar
ujjain@nas:/volume2/Files/RAIDF1$
root@DS3018xs:/volume1# ls -al *tar
-rw-r--r-- 1 ujjain root 53127639040 Nov 29 20:52 music.tar
-rw-r--r-- 1 ujjain root 375836549120 Nov 29 20:50 photo.tar
root@DS3018xs:/volume1# cat nohup.out
sending incremental file list
created directory /var/services/homes/ujjain/nfs/RAIDF1
photo.tar
rsync: chown "/var/services/homes/ujjain/nfs/RAIDF1/.photo.tar.qeeaLI" failed: Operation not permitted (1)
sent 375882427699 bytes received 31 bytes 107165339.34 bytes/sec
total size is 375836549120 speedup is 1.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1355) [sender=3.0.9]
sending incremental file list
music.tar
rsync: chown "/var/services/homes/ujjain/nfs/RAIDF1/.music.tar.mHlkfL" failed: Operation not permitted (1)
sent 53134124438 bytes received 31 bytes 105739551.18 bytes/sec
total size is 53127639040 speedup is 1.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1355) [sender=3.0.9]
root@DS3018xs:/volume1#
我的 rsync 是否成功备份所有数据?
答案1
是的,您的文件已备份,但文件所有权尚未备份。
您的目的地似乎是某种文件共享(NFS?),它不允许您更改写入其中的文件的所有权。
看起来您备份的文件的所有者与运行 rsync 的用户不同,因此 rsync 尝试更改目标文件的所有权以匹配。由于无法做到这一点,您会收到此错误。
您可以通过更改源文件的文件所有权来解决该问题。