virtualbox共享文件夹

主机:windows 8 shell

虚拟机:ubuntu server 12.04(没有图形化界面) ubuntu

一、挂载Virtualbox的增长镜像

二、在ubuntu中挂载此iso

enyo@UBUNTU /media$ sudo mount /dev/cdrom /media/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only
enyo@UBUNTU /media$ ls /media/cdrom/
32Bit        autorun.sh  runasroot.sh              VBoxWindowsAdditions-amd64.exe
64Bit        cert        VBoxLinuxAdditions.run    VBoxWindowsAdditions.exe
AUTORUN.INF  OS2         VBoxSolarisAdditions.pkg  VBoxWindowsAdditions-x86.exe

三、安装加强功能

enyo@UBUNTU /media$ sudo cdrom/VBoxLinuxAdditions.run 
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.2 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.

Building the main Guest Additions module ...done.
Building the shared folder support module ...done.
Building the OpenGL support module ...done.
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest Additions ...done.
Installing the Window System drivers ...fail!
(Could not find the X.Org or XFree86 Window System.)

enyo@UBUNTU /mnt$ sudo reboot

虽然有报错说没有桌面环境,可是不影响共享文件夹,重启设置共享文件夹便可 windows

四、设置共享文件夹

五、挂载共享文件夹

enyo@UBUNTU /media$ sudo mkdir myshare
enyo@UBUNTU /media$ sudo mount -t vboxsf myshare myshare

六、开机自动挂载文件夹

网上不少教程说把下面的代码加入/etc/fstab,重启便可 ui

myshare /media/myshare vboxsf rw,gid=100,uid=1000,auto 0 0

可是系统调用fstab的时候,Virtualbox的共享目录的模块尚未加载,因此每次加载都会失败,个人解决办法是在在/etc/rc.local文件中加入一行 this

mount -t vboxsf myshare myshare

从新启动便可实现自动挂载 spa

相关文章
相关标签/搜索