新聞中心
使用VirtualBox實(shí)現(xiàn)本機(jī)和ubuntu虛擬機(jī)之間共享文件夾,本機(jī)和虛擬機(jī)同時(shí)可以讀寫此文件夾中文件,即本機(jī)和虛擬機(jī)通過此文件夾互相傳遞數(shù)據(jù)。

我們注重客戶提出的每個(gè)要求,我們充分考慮每一個(gè)細(xì)節(jié),我們積極的做好成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作服務(wù),我們努力開拓更好的視野,通過不懈的努力,成都創(chuàng)新互聯(lián)公司贏得了業(yè)內(nèi)的良好聲譽(yù),這一切,也不斷的激勵(lì)著我們更好的服務(wù)客戶。 主要業(yè)務(wù):網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)站設(shè)計(jì),微信小程序,網(wǎng)站開發(fā),技術(shù)開發(fā)實(shí)力,DIV+CSS,PHP及ASP,ASP.Net,SQL數(shù)據(jù)庫的技術(shù)開發(fā)工程師。
第一步:安裝完虛擬機(jī)
第二步:在虛擬機(jī)設(shè)置界面,點(diǎn)擊共享文件夾(Shared folders),使用自動(dòng)掛載方式添加共享文件夾
第三部:安裝VirtualBox自帶的增強(qiáng)功能,運(yùn)行虛擬機(jī)后,在設(shè)備–安裝增強(qiáng)功能
第四步:重啟虛擬機(jī),在/media目錄中出現(xiàn)sf_Share目錄,此目錄中為共享文件夾
第二步可能出現(xiàn)如下錯(cuò)誤
模擬錯(cuò)誤,sf_Share已正常加載到ubuntu中
翻閱網(wǎng)絡(luò)和VirtualBox幫助文檔中發(fā)現(xiàn), 安裝增強(qiáng)功能前需要加載VBoxGuestAdditions.iso,默認(rèn)安裝完ubuntu時(shí),ubuntu的安裝程序加載在光驅(qū)中,導(dǎo)致VBoxGuestAdditions.iso無法加載。
解決方案:卸載掉ubuntu的安裝程序包,重新點(diǎn)擊安裝增強(qiáng)功能既可以實(shí)現(xiàn)加載及安裝。
已加載
第四步可能出現(xiàn)如下錯(cuò)誤
無權(quán)限
查閱資料發(fā)現(xiàn),VirtualBox自動(dòng)掛載,此文件夾的用戶組別為vboxsf,增加當(dāng)前用戶到vboxsf用戶組中;重啟虛擬機(jī),當(dāng)前用戶可以正常訪問共享文件夾。
修改用戶組別
VirtualBox幫助文檔介紹(版本:5.0.12.r104815)
3.11. Shared folders
Shared folders allow you to easily exchange data between a virtual machine and your host. This feature requires that the VirtualBox Guest Additions be installed in a virtual machine and is described in detail in Section 4.3, “Shared folders”.
4.1. Introduction
.......
The VirtualBox Guest Additions for all supported guest operating systems are provided as a single CD-ROM image file which is called VBoxGuestAdditions.iso. This image file is located in the installation directory of VirtualBox. To install the Guest Additions for a particular VM, you mount this ISO file in your VM as a virtual CD-ROM and install from there.(使用光盤加載方式加載VBoxGuestAdditions.iso)
The Guest Additions offer the following features:
......
Shared folders(共享目錄)
These provide an easy way to exchange files between the host and the guest. Much like ordinary Windows network shares, you can tell VirtualBox to treat a certain host directory as a shared folder, and VirtualBox will make it available to the guest operating system as a network share, irrespective of whether guest actually has a network. For details, please refer to Section 4.3, “Shared folders”.
......
`4.3.2. Automatic mounting
Starting with version 4.0, VirtualBox can mount shared folders automatically, at your option. If automatic mounting is enabled for a specific shared folder, the Guest Additions will automatically mount that folder as soon as a user logs into the guest OS. The details depend on the guest OS type:
With Windows guests, any auto-mounted shared folder will receive its own drive letter (e.g. E:) depending on the free drive letters remaining in the guest.
If there no free drive letters left, auto-mounting will fail; as a result, the number of auto-mounted shared folders is typically limited to 22 or less with Windows guests.
With Linux guests, auto-mounted shared folders are mounted into the /media directory, along with the prefix sf_. For example, the shared folder myfiles would be mounted to /media/sf_myfiles on Linux (linux系統(tǒng)中自動(dòng)掛載在/media目錄中,在共享目錄前加上sf_前綴,如共享目錄為myfiles,則在linux中掛載的目錄為/media/sf_myfiles)and /mnt/sf_myfiles on Solaris.
The guest property /VirtualBox/GuestAdd/SharedFolders/MountPrefix determines the prefix that is used. Change that guest property to a value other than “sf” to change that prefix; see Section 4.7, “Guest properties” for details.
Note
Access to auto-mounted shared folders is only granted to the user group vboxsf, which is created by the VirtualBox Guest Additions installer. Hence guest users have to be member of that group to have read/write access or to have read-only access in case the folder is not mapped writable.
To change the mount directory to something other than /media, you can set the guest property /VirtualBox/GuestAdd/SharedFolders/MountDir.
Solaris guests behave like Linux guests except that /mnt is used as the default mount directory instead of /media.`
文章標(biāo)題:VirtualBox實(shí)現(xiàn)本機(jī)和Ubuntu虛擬機(jī)之間共享文件夾
分享URL:http://fisionsoft.com.cn/article/cdhodds.html


咨詢
建站咨詢
