12343052 发表于 2015-4-16 09:25:57

【转】【教程】实现Virtualbox中的XP虚拟机和主机Win7之间的共享文件夹

  原文网址:http://www.crifan.com/add_share_folder_for_virtualbox_guest_xp_and_host_win7/
  已经实现了在主机Win7下,在Virtualbox中安装了XP虚拟机。
  现在需要将Win7中一个文件共享到XP虚拟机中。
  所以需要去折腾Virtualbox和主机之间的共享。

  1.先关闭运行中的XP虚拟机。
  2.然后去新建一个共享文件夹:
http://storage.live.com/items/9A8B8BF501A38A36!3585?filename=%e6%b7%bb%e5%8a%a0.png
  然后确保当前主机Win7中,存在一个用于共享的文件夹,此处是新建了一个share_to_xp文件夹:
http://storage.live.com/items/9A8B8BF501A38A36!3586?filename=%e6%96%b0%e5%bb%ba%e4%b8%80%e4%b8%aashare_to_xp%e6%96%87%e4%bb%b6%e5%a4%b9%e7%94%a8%e4%ba%8e%e5%85%b1%e4%ba%ab.png
http://storage.live.com/items/9A8B8BF501A38A36!3587?filename=%e8%87%aa%e5%8a%a8%e6%8c%82%e8%bd%bd.png
http://storage.live.com/items/9A8B8BF501A38A36!3588?filename=%e5%9b%ba%e5%ae%9a%e5%88%86%e9%85%8d%20%e7%9c%8b%e5%88%b0%e6%96%b0%e5%bb%ba%e7%9a%84.png
  
  3.运行XP虚拟机。
  参考Virtualbox的帮助文件中的”4.3. Shared folders“中的:

  There are several ways in which shared folders can be set up for a particular virtual machine:


[*]In the window of a running VM, you can select "Shared folders" from the "Devices" menu, or click on the folder icon on the status bar in the bottom right corner.
[*]If a VM is not currently running, you can configure shared folders in each virtual machine’s "Settings" dialog.
[*]From the command line, you can create shared folders using VBoxManage, as follows:
VBoxManage sharedfolder add "VM name" --name "sharename" --hostpath "C:\test"
  See Section 8.28, “VBoxManage sharedfolder add/remove” for details.


  去在运行中的XP,点击虚拟机菜单中的:设备->共享文件夹:
http://storage.live.com/items/9A8B8BF501A38A36!3589?filename=%e8%ae%be%e5%a4%87%20%e5%85%b1%e4%ba%ab%e6%96%87%e4%bb%b6%e5%a4%b9.png
  结果跳出提示:
  VirtualBox功能增强包似乎在该虚拟机中不可用,没有它们,共享文件夹将无法使用。
http://storage.live.com/items/9A8B8BF501A38A36!3590?filename=VirtualBox%e5%8a%9f%e8%83%bd%e5%a2%9e%e5%bc%ba%e5%8c%85%e4%bc%bc%e4%b9%8e%e5%9c%a8%e8%af%a5%e8%99%9a%e6%8b%9f%e6%9c%ba%e4%b8%ad%e4%b8%8d%e5%8f%af%e7%94%a8%ef%bc%8c%e6%b2%a1%e6%9c%89%e5%ae%83%e4%bb%ac%ef%bc%8c%e5%85%b1%e4%ba%ab%e6%96%87%e4%bb%b6%e5%a4%b9%e5%b0%86%e6%97%a0%e6%b3%95%e4%bd%bf%e7%94%a8%e3%80%82.png
  点击”确定“后会跳出”共享文件夹“的对话框:
http://storage.live.com/items/9A8B8BF501A38A36!3591?filename=%e8%b7%b3%e5%87%ba%e5%85%b1%e4%ba%ab%e6%96%87%e4%bb%b6%e5%a4%b9%e5%af%b9%e8%af%9d%e6%a1%86.png
  此处点击确定,先暂不管它。
  因为其提示需要安装增强包,所以先去安装增强功能包,然后才能使用共享文件夹。
  
  
  4. 关于如何为VirtualBox中安装增强功能,详见:
  【教程】如何为VirtualBox安装 Guest Additions/增强工具包/功能增强包/增强功能包
  
  5.安全完毕功能增强包后,重启XP后,也就可以看到了,XP中会多个一个网络共享盘:
  vbboxsrv上的 share_to_xp(G:) 网络驱动器
http://storage.live.com/items/9A8B8BF501A38A36!3600?filename=%e7%bd%91%e7%bb%9c%e9%a9%b1%e5%8a%a8%e5%99%a8%20vboxsrv.png
  这个就是我们所需要的共享文件夹了。
  然后把一些文件放到主机Win7中的共享文件夹:
http://storage.live.com/items/9A8B8BF501A38A36!3601?filename=win7%20file.png
  然后XP虚拟机中,进入该共享文件夹中,就可以看到共享出来的文件了:
http://storage.live.com/items/9A8B8BF501A38A36!3602?filename=%e5%8f%af%e4%bb%a5%e7%9c%8b%e5%88%b0%e5%85%b1%e4%ba%ab%e5%87%ba%e6%9d%a5%e7%9a%84%e6%96%87%e4%bb%b6%e4%ba%86.png
  
  【总结】
  想要实现,VirtualBox中的XP虚拟机和主机(Win7)中共享文件(夹)的话,需要:
  1. 安装增强功能包(Oracle VM VirtualBox Guest Additions)
  由于共享文件夹的功能,是包含在增强功能包内的,所以需要先装增强功能包,才能使用共享文件夹。
  此处只先截图说明一下:
  设备->安装增强功能
http://storage.live.com/items/9A8B8BF501A38A36!3592?filename=%e8%ae%be%e5%a4%87%20%e5%ae%89%e8%a3%85%e5%a2%9e%e5%bc%ba%e5%8a%9f%e8%83%bd.png
  
  详细内容,还请参见:
  【教程】如何为VirtualBox安装 Guest Additions/增强工具包/功能增强包/增强功能包
  
  2.在虚拟机的设置中添加共享文件夹
  再去XP虚拟机配置中,设置对应共享文件夹:
  设置->共享文件夹->添加共享文件夹->选择对应的文件夹->设置为"自动加载"->确定,就可以看到新添加的共享文件夹了:
http://storage.live.com/items/9A8B8BF501A38A36!3588?filename=%e5%9b%ba%e5%ae%9a%e5%88%86%e9%85%8d%20%e7%9c%8b%e5%88%b0%e6%96%b0%e5%bb%ba%e7%9a%84.png
  
  如此,再次重新运行XP虚拟机,就可以看到XP虚拟机中会多出一个vboxsrv(VirtualBox Server的缩写)的共享盘:
http://storage.live.com/items/9A8B8BF501A38A36!3600?filename=%e7%bd%91%e7%bb%9c%e9%a9%b1%e5%8a%a8%e5%99%a8%20vboxsrv.png
  就是我们所要的共享文件夹了。
页: [1]
查看完整版本: 【转】【教程】实现Virtualbox中的XP虚拟机和主机Win7之间的共享文件夹