rsync 错误 - 意外的远程参数:root@1.2.3.4:/*

Key*_*Jey 5 linux bash rsync

我正在尝试使用 rsync 将 centos 服务器迁移到一个新机器,并在目标服务器中运行此命令:

 rsync -auHxv –numeric-ids –exclude=/etc/fstab
 –exclude=/etc/sysconfig/network-scripts/* –exclude=/proc/*
 –exclude=/tmp/* –exclude=/sys/* –exclude=/dev/* –exclude=/mnt/*
 –exclude=/boot/* –exclude=/root/* root@1.2.3.4:/* /
Run Code Online (Sandbox Code Playgroud)

然后我收到这个错误:

Unexpected remote arg: root@1.2.3.4:/*
rsync error: syntax or usage error (code 1) at main.c(1201) [sender=3.0.6]
Run Code Online (Sandbox Code Playgroud)

Sim*_*ast 8

我刚刚遇到了类似的错误,以下内容可能会解决您的问题:

  • 确保前面--exclude两个连字符
  • 在排除的路径周围加上引号,例如 --exclude '/boot/*'

该错误令人困惑,因为它实际上与目标参数无关,而通常是在它之前的参数具有不正确的语法。