Debian on VirtualBox共享win7文件夹

如果是一个全新的Debian系统,直接安装VirtualBox的Guest Additions,可能会失败,这是因为VirtualBox增强功能需要编译链接工具。
启动debian虚拟机时记得先加载debian安装光盘
aptitude install build-essential linux-headers-`uname -r` dkms
1. 加载增强功能光盘

Debian on VirtualBox共享win7文件夹


cd /cdrom
sh ./VBoxLinuxAdditions.run
其中,有个警告说是系统不支持OpenGL。重启,增强功能包安装完成。

2. 在虚拟机上设置共享文件夹

Debian on VirtualBox共享win7文件夹

 

3. 挂载

Debian on VirtualBox共享win7文件夹

mkdir /mnt/shared
mount -t vboxsf share /mnt/shared
share是之前创建的共享文件夹的名字。
umount /mnt/shared

编辑/etc/fstab,自动挂载
share /mnt/shared vboxsf rw,gid=100,uid=1000,auto 0 0

安装时遇到提示:
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.
 ...fail!
有可能是没有安装dkms。

如果共享文件夹名称和挂载点名称相同,在挂载时会出现如下的错误信息:
/sbin/mount.vboxsf: mounting failed with the error: Protocol error