What are you in the mood for today?

Sunday, 25 May 2014

Accessing your VirtualBox localy

Hi there, following on from VirtualBox networking. The next thing we need is to allow for easy sharing of files between the host and guest. Now we could use something like FTP or samba. However VirtualBox provides a built in feature to map a Host folder on to the guest file system. I will be honest its a bit tricky to get working, but hopefully this post should help.

So there are 4 steps to do this.

Select the folder to share

Install packages needed by VirtualBox

Install VirtualBox's guest tools

Mount the shared folder

From the main screen.
Open the settings
Click the Add icon. To add a pointer to your local folder that you want to share.
Select your folder, check "Auto-mount" & "Make Permanent"

now fire up your VM
Now, if we check are share in the bottom of the window

Ok. Before we install the "Guest tools" we need to install some required packages

sudo apt-get update

sudo apt-get install make

sudo apt-get install gcc

sudo apt-get install dkms

Now we need to attach the "Guest Tool" installer image. Its very easy
After you have click it. You won't get a prompt.
If you may get something like this
Just press "Force Unmount"
Now mount the "Guest Tool" image

sudo mount /dev/cdrom /mnt

Next to to run the installer for Linux

sudo /mnt/VBoxLinuxAdditions.run

Make the folder we want to map into

sudo mkdir /remoteShare

This will take the shared folder on the host machine mirror it to the guest folder. *remember you refer to host folder by its alias.

sudo mount.vboxsf myShare /remoteShare

Now you can move in to the folder

cd /remoteShare/

If you have added some files locally. you can see them with the 'ls' command