在运行CoreOS VM的vagrant的Windows上使用rsync [英] Using rsync on windows with vagrant running a CoreOS VM

查看:1717
本文介绍了在运行CoreOS VM的vagrant的Windows上使用rsync的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Windows 8.1 Pro pc运行vagrant和cygwin的rsync。



我这样配置:

  config.vm.synced_folder../sharedFolder,/ vagrant_data,type:rsync

当我执行 vagrant up 时,得到以下错误:

  C:\dev\vagrantBoxes\coreOS> vagrant up 
使用'virtualbox'提供程序将机器'默认'上传到...
==> ;默认:检查框'yungsang / coreos'是否是最新的...
==> default:清除任何先前设置的转发端口...
==>默认:清除任何以前设置的网络接口...
==> default:基于配置准备网络接口...
默认值:适配器1:nat
==>默认:转发端口...
默认值:22 => 2222(adapter 1)
==>默认:运行'pre-boot'VM自定义...
==>默认值:引导VM ...
==>默认值:等待机器启动。这可能需要几分钟...
默认值:SSH地址:127.0.0.1:2222
默认值:SSH用户名:core
默认值:SSH认证方法:私钥
默认值:警告:连接超时。正在重试...
==>默认:机器启动并准备好!
==>默认:Rsyncing文件夹:/ c / dev / vagrantBoxes / sharedFolder / => / vagrant_data
尝试rsync已同步的文件夹时出错。
请检查下面的错误消息了解更多信息。

主机路径:/ c / dev / vagrantBoxes / sharedFolder /
访客路径:/ vagrant_data
命令:rsync --verbose --archive --delete -z --copy -links --chmod = ugo = rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyChecking = no -o UserKnownHostsFile = / d
ev / null -i'C:/Users/aaron.axisa/.vagrant.d/insecure_private_key'--exclude .vagrant / / c / dev / vagrantBoxes / sharedFolder / core@127.0.0.1:/ vagrant_data
错误:警告:将[[127.0.0.1]:2222'(RSA)永久添加到已知主机列表中。
rsync:change_dir/ c / dev / vagrantBoxes / sharedFolder失败:没有这样的文件或目录(2)
rsync错误:一些文件/ attrs没有传输(见前面的错误) at /usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c(1052)[sender = 3.0.9]



我假设这是一个问题,如何将目录路径更改为/ c / dev而不是C:\dev

解决方案

从我的测试,如果你使用cygwin,使用@ osroot25的解决方案。



如果您正在使用cwRsync并且不有cygwin,则除非将源代码编辑为@Andrew Myers详细信息,否则没有解决方法使用Vagrant 。测试使用Vagrant v1.6.5。



我的解决方法适用于我是绕过Vagrant完全使用cwRsync直接。这适用于我,因为我正在同步一个几乎没有改变的文件夹。我可能在一天内改变了很多次(所以我必须记住每次下面的步骤2),但我会去几周(或几个月)没有任何变化。记住,要使用cwRsync,您必须编辑和使用cwrsync.cmd脚本。尝试直接访问rsync.exe命令或将其添加到您的路径将会失败。步骤1:我在cwrsync.cmd(已安装的文件夹)的末尾添加了以下行:




rsync -re ssh -p 2222/ cygdrive / b / VCS / packages / vagrant @ localhost:packages --exclude.git /


$ b b

步骤2:我有一个单独的cmd窗口打开,我运行cwrsync.cmd使用完整路径。然后,如果我需要同步更改到VM,我激活该窗口,向上箭头,返回,更新是即时!



修改ENV设置cygwin修复由@ osroot25不能使用cwRsync,因为当你强制cygwin检测,vagrant ssh命令将无法工作,因为需要 cygpath中的cygpath命令,你不会有,所以你不能ssh进入VM。你可以直接使用ssh命令和所有正确的选项。


I am using windows 8.1 Pro pc running vagrant and cygwin's rsync.

I am configuring as such:

config.vm.synced_folder "../sharedFolder", "/vagrant_data", type: "rsync"

And when I execute vagrant up I get the following error:

C:\dev\vagrantBoxes\coreOS>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'yungsang/coreos' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: core
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Rsyncing folder: /c/dev/vagrantBoxes/sharedFolder/ => /vagrant_data
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/dev/vagrantBoxes/sharedFolder/
Guest path: /vagrant_data
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/d
ev/null -i 'C:/Users/aaron.axisa/.vagrant.d/insecure_private_key' --exclude .vagrant/ /c/dev/vagrantBoxes/sharedFolder/ core@127.0.0.1:/vagrant_data
Error: Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts.
rsync: change_dir "/c/dev/vagrantBoxes/sharedFolder" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at /usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c(1052) [sender=3.0.9]

I assume it is an issue with how it is changing the directory path to /c/dev rather than C:\dev

解决方案

From my testing, if you are using cygwin, use the solution by @osroot25 .

If you are using cwRsync and do not have cygwin, there is no workaround using Vagrant except editing the source code as @Andrew Myers details. Tested using Vagrant v1.6.5.

My workaround that works for me is to bypass Vagrant altogether and use cwRsync directly. This works for me because I am syncing a folder that hardly ever changes. I might change it quite a few times in one day (so I have to remember step 2 below each time), but I then go weeks (or months) without any changes. Remember that to use cwRsync you have to edit and use the cwrsync.cmd script. Attempting to access the rsync.exe command directly or by adding it to your path will fail. Step 1: I added the following line to the end of cwrsync.cmd (in the installed folder):

rsync -re "ssh -p 2222" /cygdrive/b/VCS/packages/ vagrant@localhost:packages --exclude ".git/"

Step 2: I have a separate cmd window open that I run the cwrsync.cmd using the full path. Then if I need to sync changes onto the VM, I activate that window, up-arrow, return and updating is instant!

Modifying ENV to set cygwin fix by @osroot25 doesn't work with cwRsync because when you force cygwin detection, the "vagrant ssh" command will not work because it requires the cygpath command in cygwin, which you won't have, so you cannot ssh into the VM. Well you can if you use the ssh command directly with all the right options.

这篇关于在运行CoreOS VM的vagrant的Windows上使用rsync的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆