How Do You Set Up a Shared Drive or Folder Using Oracle VirtualBox?

Problem scenario:  You want to transfer files between a host machine running Oracle VirtualBox and a guest server.  By sharing media, your Oracle VirtualBox is much more useful.  How do you configure a folder to be shared between the host machine that runs Oracle VirtualBox and a virtual guest OS?   

These directions are for Oracle VirtualBox running on a Windows 7 Professional host with a guest virtual server running Linux, specifically CentOS 7.x.  If you want to have a USB stick be the shared drive, physically insert it into your Windows desktop now.  Create a folder on this USB stick.

1.  a)   Identify a folder on your Windows host machine that you want to be a share with your Linux guest VM.

b)  This step only needs to be performed one time.  You may be able to skip this step if it has been performed previously.  In Oracle VirtualBox open the CentOS VM.  Go to Devices -> Shared Folders -> Shared Folder Settings.  Click the folder icon with a green plus sign (to add a folder).

Then go to the "Folder Path" drop down then find the folder on the Windows server you want to add.  For folder name, enter whichever name you want.  For these directions we will call it "contint".  If you are actually following these directions and not just reading them, replace "contint" with the name you chose here.  Check the options for "Auto-mount" and "Make Permanent."  Click "Ok."

2.a.  On the Linux guest, run this command:  yum update kernel*
b.  Reboot the guest server.
c.  In Oracle VirtualBox Go to Devices -> Insert Guest Additions CD Image.  Unless you received an error, proceed to step #3.  If you get an error and failure do the following: verify VBoxGuestAdditions.iso is on your Windows host.  Then in Oracle VirtualBox go to Devices -> Optical Drives -> Choose disk image.  Then navigate to the VBoxGuestAdditions.iso file.

3.  This step only needs to be performed one time.  You may be able to skip this step if it has been performed previously.  On the Linux guest VM, run these five commands:

mkdir /media/VirtualBoxGuestAdditions
mount -r /dev/cdrom /media/VirtualBoxGuestAdditions
yum -y install bzip2 gcc make perl kernel-devel
KERN_DIR=/usr/src/kernels/`uname -r`
export KERN_DIR

If applicable, we find this message to be ignorable:
"Could not find the or XFree86 Window System, skipping."

4.  Run these commands on the Linux guest VM:
mkdir /mnt/windows-share
mount -t vboxsf contint /mnt/windows-share  # where "contint" was the name chosen in step 1. b.

Leave a comment

Your email address will not be published. Required fields are marked *