背景
我正在尝试对我的 Ubuntu 系统进行非常全面的备份。我正在运行以下rsync
命令:
sudo rsync -aAEHSXxv --progress --delete --exclude={/home/sterlingbutters/Butters-Ubuntu-Backup/*, /home/*/.cache/*, /home/*/.local/share/Trash/*, /dev/*, /proc/*, /sys/*, /tmp/*, /mnt/*, /media/*, /lost+found} / /home/sterlingbutters/Butters-Ubuntu-Backup
其中文件结构应该非常明显。
问题
我收到有关不存在的文件/目录的以下输出:
rsync: change_dir "/home/*/.cache" failed: No such file or directory (2) rsync: change_dir "/home/*/.local/share/Trash" failed: No such file or directory (2) rsync: link_stat "/dev/*," failed: No such file or directory (2) rsync: link_stat "/proc/*," failed: No such file or directory (2) rsync: link_stat "/sys/*," failed: No such file or directory (2) rsync: link_stat "/tmp/*," failed: No such file or directory (2) rsync: link_stat "/mnt/*," failed: No such file or directory (2) rsync: link_stat "/media/*," failed: No such file or directory (2) rsync: link_stat "/lost+found}" failed: No such file or directory (2) created directory /home/sterlingbutters/Butters-Ubuntu-Backup IO error encountered -- skipping file deletion
这是否意味着该文件在源或目标上不存在?(因为它们显然存在于源上)
稍后,我开始收到一堆关于
.cache
我以为已排除的目录的条目:... home/sterlingbutters/.cache/mozilla/firefox/90d4yr8z.default/cache2/entries/76A1426700B3173C5B976F65F04FA6CD01D90D15 ...
我担心“只是看看会发生什么”,因为如果目录没有被正确排除,我可能会陷入无限的复制循环,因为目标目录位于 ~/.
我的代码几乎完全遵循文档在这里(我所做的唯一更改我认为仍然可以接受):我还觉得我的语法遵循了我在其他论坛帖子中发现的语法。即使没有,这是否会导致它与链接中的文档之间出现差异?
非常感谢所有帮助-谢谢!
答案1
您的rsync
命令行几乎是正确的。
排除列表中的逗号后不应有空格,
sudo rsync -aAEHSXxv --progress --delete --exclude={/home/sterlingbutters/Butters-Ubuntu-Backup/*,/home/*/.cache/*,/home/*/.local/share/Trash/*,/dev/*,/proc/*,/sys/*,/tmp/*,/mnt/*,/media/*,/lost+found} / /home/sterlingbutters/Butters-Ubuntu-Backup