ubuntu下共享windows下的目录

 在Windows 7下安装了VirtualBox,然后通过VirtualBox虚拟安装了ubuntu10.10,现在想在ubuntu10.10下访问Windows中的一些文件,需要在VirtualBox中配置数据空间:
 
VirtualBox 4.1.10
 
[root@zuantianyang-lnx ~]# lsb_release -a
LSB Version:    :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: ubuntu
Description:    ubuntu10.10
Release:        10.10
  
1.安装VirtualBox Guest Addition。点击"设备"菜单下面的“安装增强功能”:
 
[root@zuantianyang-lnx VBOXADDITIONS_4.0.8_71778]$ ls -lrt
总计 37520
-r-xr-xr-x 1 root root   278832 05-31 22:17 VBoxWindowsAdditions.exe
-r-xr-xr-x 1 root root  9284432 05-31 22:17 VBoxWindowsAdditions-amd64.exe
-r-xr-xr-x 1 root root 14664192 05-31 22:17 VBoxSolarisAdditions.pkg
-r-xr-xr-x 1 root root  7853516 05-31 22:17 VBoxLinuxAdditions.run
-r-xr-xr-x 1 root root     5523 05-31 22:17 runasroot.sh
-r-xr-xr-x 1 root root     6966 05-31 22:17 autorun.sh
-r-xr-xr-x 1 root root      647 05-31 22:17 AUTORUN.INF
dr-xr-xr-x 2 root root     4096 05-31 22:17 64Bit
dr-xr-xr-x 3 root root     4096 05-31 22:17 32Bit
-r-xr-xr-x 1 root root  6190464 05-31 22:17 VBoxWindowsAdditions-x86.exe
[root@zuantianyang-lnx VBOXADDITIONS_4.0.8_71778]$ ./VBoxLinuxAdditions.run
 
2. VirtualBox的设置中找到数据空间,添加要共享的文件夹,选择Auto-Mount和固定分配:
 
设备-->分配数据空间-->添加数据空间
 
我选择了整个Win7下的C盘, 数据空间位置C:\, 数据空间名称C_DRIVE
 
 
 
3. 确认/sbin/mount.vboxsf存在
 
4.查看boxvfs模块是否加载:lsmod | grep vboxvfs,如果没有加载,执行modprobe vboxvfs命令加载
 
5. 创建好mout点:
 
[root@zuantianyang-lnx ~]# cd /
[root@zuantianyang-lnx /]# mkdir WIN7_C_DRIVE
 
[root@zuantianyang-lnx /]# mount -t vboxsf C_DRIVE WIN7_C_DRIVE
 
C_DRIVE是数据空间名称,对应的是共享的Windows下的文件夹。
 
6.想让机器重启后还能访问Windows的文件夹,在ubuntu重启后自动mount即可,需要修改/etc/fstab,加入
 
C_DRIVE   /WIN7_C_DRIVE  vboxsf defaults 0 0保存即可,挂载windows的共享目录C_DRIVE到ubuntu下/WIN7_C_DRIVE
 
[root@zuantianyang-lnx ~]# cd /etc/
[root@zuantianyang-lnx etc]# vi fstab 
 
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
 
# Automatically mount Windows7 C_DRIVE to /WIN7_C_DRIVE during startup, byrneyang.
C_DRIVE /WIN7_C_DRIVE vboxsf defaults 0 0

posted on 2013-09-13 15:49  高董  阅读(384)  评论(0编辑  收藏  举报

导航