主機:windows 8 shell
虛擬機:ubuntu server 12.04(沒有圖形化界面) ubuntu
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