rsync 备份到外部硬盘 exFat 失败

rsync backup to external hard disk exFat fails

我试图将数据从我的 macbook 备份到外部硬盘 - 格式化为 exFat(因为 Windows 和 Linux/Mac 兼容性) .

我将使用 Automator 创建一个小程序,以轻松备份我的数据。它在本地驱动器上以及从本地驱动器到 SD 卡上运行良好。但它不适用于从本地驱动器到外部硬盘驱动器。怎么了?

SOURCE=/Users/username/Pictures/test
TARGET=/Volumes/Backup/
LOG=~/Documents/AutomatorLogs/BackupSync.log

rsync -aze "ssh" --delete --exclude=".*" "$SOURCE" "$TARGET" > "$LOG"

我收到这个错误:

rsync: recv_generator: mkdir "/Volumes/Backup/test" failed: Permission denied (13)

看起来您是 运行 命令的用户没有在 /Volumes/Backup/ 目录中创建新目录的权限。

要解决这个问题,您可能需要更改该目录的权限,以便您的脚本能够写入该目录并创建用于进行备份的新目录。

这里有一些关于权限的链接:

http://linuxcommand.org/lts0070.php

http://www.perlfect.com/articles/chmod.shtml

我想,我知道了:

It is related to the name of the external hard disk. With the name "Backup" for my external hard drive, it does not work. If I changed the name to anything else, it works.

(我用其他名称测试了一些其他 exFat 格式的外部硬盘驱动器并且它可以工作。所以我将这个外部驱动器的名称更改为其他任何名称,现在它可以工作了。疯狂...)

我知道这是旧的,但我只是 运行 进入这个,我想确保包含这个信息。我知道 OP 有点不同,但我使用的是 macbook 并且 运行 进入我描述的错误所以我不知道即使更改磁盘名称它如何工作。

当目标是 exfat 驱动器时,rsync 不能使用 -a。它将创建目录并且似乎正在备份但实际上没有创建文件。您需要使用:

rsync -rltDv [SRC] [DESTINATION]

where:
    -v, --verbose               increase verbosity
    -r, --recursive             recurse into directories
    -l, --links                 copy symlinks as symlinks
        --devices               preserve device files (super-user only)
        --specials              preserve special files
    -D                          same as --devices --specials
    -t, --times                 preserve times

原因是rsync不处理exfat的权限。您将看到一个 rsync 错误(在 syslog 中或者如果您使用 control-c out):

chgrp [file] failed: Function not implemented (38)