Share folders with Virtual machine using Virtualbox

Since we use Windows Vista as default, we are used to load virtual machines to try linux stuff, and it will be nice if we can share folders between host (windows) and guest (linux) machines.

The document “shared folders” had some traps, and I can’t make it work, below are list some important steps to get it work

Envrionment

Ubuntu 11.04 (Natty) as guest OS and Virtualbox as virtual machine management tools

Install Guest Additions

Virtualbox Guest Additions should be installed for shared folders, it is a .iso files to be mounted, when it is mounted in guest OS (Ubuntu), it can be executed

image

Install linux kernel

I met the following error when I try to install the guest additional

[guest] # cat /var/log/vboxadd-install.log
Makefile:23: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again..  Stop.

After googled, I found the good article http://blog.oracle48.nl/adding-shared-folders-to-virtual-box-guest-using-the-command-line/, later I noticed it existed inside chapter 4 as well.

Therefore I need to install dkms package and related headers (it depends on which kernel you use)

apt-get install dkms
apt-get install linux-headers-2.6.38-11-generic
Shared folder from host to guest

it can be easily configured in virtual machines’ setting, if you set it automatically, it will exist when reboot

image

If it goes well, you will see it /media/sf_sdcamp, which works if you run in root id, and as documented, you can also mount it for normal user.

mount –t vboxsf sdcamp /mnt/sdcamp

/mnt/sdcamp should be created in advance

Anyway, now it works very well, I edited in Windows Environment, and run some specical commands under linux environment

Tags:

Leave a Reply