beautypg.com

Sun Microsystems VIRTUALBOX VERSION 3.1.0_BETA2 User Manual

Page 69

background image

4 Guest Additions

the host and are then shared with the guest; sharing is accomplished using a special
service on the host and a file system driver for the guest, both of which are provided
by VirtualBox.

In order to use this feature, the VirtualBox Guest Additions have to be installed.

Note however that Shared Folders are only supported with Windows (2000 or newer),
Linux and Solaris guests.

To share a host folder with a virtual machine in VirtualBox, you must specify the

path of that folder and choose for it a “share name” that the guest can use to access it.
Hence, first create the shared folder on the host; then, within the guest, connect to it.

There are several ways in which shared folders can be set up for a particular virtual

machine:

• In the graphical user interface of a running virtual machine, you can select

“Shared folders” from the “Devices” menu, or click on the folder icon on the
status bar in the bottom right corner of the virtual machine window.

• If a virtual machine is not currently running, you can configure shared folders in

each virtual machine’s “Settings” dialog.

• From the command line, you can create shared folders using the VBoxManage

command line interface; see chapter

8

,

VBoxManage reference

, page

106

. The

command is as follows:

VBoxManage sharedfolder add "VM name"

--name "sharename" --hostpath "C:\test"

There are two types of shares:

1. VM shares which are only available to the VM for which they have been defined;

2. transient VM shares, which can be added and removed at runtime and do not

persist after a VM has stopped; for these, add the --transient option to the
above command line.

Shared folders have read/write access to the files at the host path by default. To

restrict the guest to have read-only access, create a read-only shared folder. This can
either be achieved using the GUI or by appending the parameter --readonly when
creating the shared folder with VBoxManage.

Then, you can mount the shared folder from inside a VM the same way as you would

mount an ordinary network share:

• In a Windows guest, starting with VirtualBox 1.5.0, shared folders are

browseable and are therefore visible in Windows Explorer. So, to attach the
host’s shared folder to your Windows guest, open Windows Explorer and look
for it under “My Networking Places” -> “Entire Network” -> “VirtualBox Shared
Folders”. By right-clicking on a shared folder 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 following:

69