4.3. Shared Folders
With the shared folders feature of Oracle VM VirtualBox, you can entree files of your horde system from within the guest arrangement. This is exchangeable to how you would use network shares in Windows networks, except that shared folders do not require network, only the Guest Additions. Shared folders are supported with Windows 2000 or late, Linux, and Oracle Solaris guests. Oracle VM VirtualBox includes experimental support for Mac OS X and OS/2 guests. Shared folders physically reside on the host and are then shared with the guest, which uses a particular file system driver in the Guest Additions to talk to the host. For Windows guests, shared folders are implemented as a pseudo-network redirector. For Linux and Oracle Solaris guests, the Guest Additions provide a virtual file system. To share a host booklet with a virtual machine in Oracle VM VirtualBox, you must specify the path of the folder and choose a share name that the guest can use to access the shared folder. This happens on the server. In the node you can then use the parcel name to connect to it and access files. There are several ways in which shared folders can be set up for a virtual machine :
Reading: 4.3. Shared Folders
- In the window of a run VM, you select Shared Folders from the Devices menu, or chatter on the booklet icon on the status bar in the penetrate good corner .
- If a VM is not presently running, you can configure shared folders in the virtual car ‘s Settings dialogue .
- From the command line, you can create shared folders using VBoxManage, as follows :
VBoxManage sharedfolder add "VM name" --name "sharename" --hostpath "C:\test"
See section 7.31, “ VBoxManage sharedfolder add/remove ” .
There are two types of shares :
- permanent wave shares, that are saved with the VM settings .
- transient shares, that are added at runtime and melt when the VM is powered off. These can be created using a checkbox in the VirtualBox Manager, or by using the
--transientoption of the VBoxManage
sharedfolder add dominate .
Shared folders can either be read-write or read-only. This means that the guest is either allowed to both read and write, or just read files on the host. By default, shared folders are read-write. Read-only folders can be created using a checkbox in the VirtualBox Manager, or with the
--readonly option of the VBoxManage sharedfolder add command. Oracle VM VirtualBox shared folders besides support symbolic links, besides called symlinks, under the comply conditions :
- The host operate system must support symlinks. For example, a Mac OS X, Linux, or Oracle Solaris horde is required .
- presently lone Linux and Oracle Solaris Guest Additions support symlinks .
- For security reasons the guest o is not allowed to create symlinks by nonpayment. If you trust the guest OS to not abuse the functionality, you can enable creation of symlinks for a share folder as follows :
VBoxManage setextradata "VM name" VBoxInternal2/SharedFoldersEnableSymlinksCreate/
4.3.1. Manual Mounting
You can mount the shared folder from inside a VM, in the same manner as you would mount an ordinary network plowshare :
- In a Windows node, shared folders are browseable and consequently visible in Windows Explorer. To attach the host’s shared folder to your Windows guest, open Windows Explorer and spirit for the folder in My
Networking Place second, Entire
Network, Oracle VM VirtualBox
Shared Folders. By right-clicking on a shared booklet and selecting Map Network
Drive from the menu that pops up, you can assign a drive letter to that shared folder. alternatively, on the Windows command line, use the follow command :
net use x: \\vboxsvr\sharename
vboxsvris a pay back appoint, notice that
vboxsrvwould besides work, replace
x:with the tug letter that you want to use for the share, and
sharenamewith the share mention specified with VBoxManage.
- In a Linux guest, use the comply dominate :
mount -t vboxsf [-o OPTIONS] sharename mountpoint
To mount a share folder during boot, add the come entrance to
sharename mountpoint vboxsf defaults 0 0
- In a Oracle Solaris guest, use the following command :
mount -F vboxfs [-o OPTIONS] sharename mountpoint
sharename, use a lowercase string, with the share name specified with VBoxManage or the VirtualBox Manager. Replace
mountpointwith the path where you want the contribution to be mounted on the guest, such as
/mnt/share. The usual saddle horse rules apply. For case, create this directory inaugural if it does not exist so far. here is an exemplar of mounting the shared booklet for the exploiter jack on Oracle Solaris :
$ id uid=5000(jack) gid=1(other) $ mkdir /export/home/jack/mount $ pfexec mount -F vboxfs -o uid=5000,gid=1 jackshare /export/home/jack/mount $ cd ~/mount $ ls sharedfile1.mp3 sharedfile2.txt $
Beyond the standard options supplied by the mount command, the following are available :
This choice sets the character determine used for I/O operations. note that on Linux guests, if the
iocharsetchoice is not specified, then the Guest Additions driver will attempt to use the character set specified by the CONFIG_NLS_DEFAULT kernel option. If this choice is not set either, then UTF-8 is used .
This option specifies the fictional character set used for the shared booklet name. This is UTF-8 by default. The generic mount options, documented in the mount manual page, enforce besides. particularly useful are the options
mode, as they can allow access by normal users in read/write mood, depending on the settings, even if root has mounted the filesystem .
- In an OS/2 guest, use the VBoxControl dominate to manage share folders. For example :
VBoxControl sharedfolder use D: MyShareName VBoxControl sharedfolder unuse D: VBoxControl sharedfolder list
As with Windows guests, shared folders can besides be accessed via UNC using
\\VBoxSrv\as the server name and the shared booklet name as
4.3.2. Automatic Mounting
Oracle VM VirtualBox provides the choice to mount shared folders mechanically. When automatic mount is enabled for a shared folder, the Guest Additions service will mount it for you mechanically. For Windows or OS/2, a favored drive letter can besides be specified. For Linux or Oracle Solaris, a saddle horse point directory can besides be specified. If a drive letter or mountain charge is not specified, or is in use already, an option location is found by the Guest Additions military service. The service searches for an alternative localization depending on the node OS, as follows :
- Windows and OS/2 guests. Search for a free driveway letter, starting at
Z:. If all drive letters are assigned, the booklet is not mounted .
- Linux and Oracle Solaris
guests. Folders are mounted under the
/mediadirectory. The folder name is normalized ( no spaces, slashes or colons ) and is prefixed with
For model, if you have a shared booklet called
myfiles, it will appear as
/media/sf_myfilesin the guest. The guest properties
/VirtualBox/GuestAdd/SharedFolders/MountDirand the more generic
/VirtualBox/GuestAdd/SharedFolders/MountPrefixcan be used to override the automatic mount directory and prefix. See incision 4.7, “ Guest Properties ” .
Access to an mechanically mounted shared booklet is granted to everyone in a Windows guest, including the guest drug user. For Linux and Oracle Solaris guests, entree is restricted to members of the group
vboxsf and the
root user .