前提:安装好了VBoxAddition增强工具
首先,在虚拟机下 设备->分配数据空间 添加一个XP下的共享文件夹 如 E:/vboxshared ,名称为 vboxshared
然后,将其挂载在Ubuntu下
sudo mount -t vboxsf vboxshared /home/skytone/liujh
这样 XP下 E:/vboxshared 和Ubuntu下 /home/skytone/liujh就实现了共享
如果不想每次都手动挂载,可以在 /etc/fstab 中添加一项
vboxshared home/skytone/liujh vboxsf rw,gid=0,uid=0,auto 0 0
这里我的用户ID是ROOT ,UID GID都是0
卸载的话是
sudo umount -f home/skytone/liujh
注意:共享文件夹的名称不能和挂载点名称一样!
12.20 更新
经测试证实,在fstab加一项的方法在启动时候有时候会出现无法挂载的报错,原因是“Using /etc/fstab has little effect, because that file is processed before the SF module is loaded and will fail to mount the share.”,也就是说 /etc/fstab 是在SF模块加载之前被执行的,所以无法挂载。
解决方法是,如果要想让每次开机的时候自动挂载,将挂载语句加到 /etc/rc.local 中,因为 /etc/rc.local 是在启动的最后才加载的,因此就可以挂载成功。如:“If you want to have it mount automatically upon each boot, put the mount command in /etc/rc.local (Debian based distro's), or whatever script is run at the end of the boot process.”