Tonight I needed to mount a share from my host OS to a VirtualBox virtual machine (vm) running JeOS. To get the job done, I had to mix a few different resources so I figured I would make a nice compact guide here.
- Create the VirtualBox share. I believe the virtual machine is supposed to be turned off for this step, but I do not know if it actually matters. I did this using a GUI, but it is my understanding you can do it with this command (JeOS – name of vm, share – name of share, /home/your/shared/folder – path to shared folder, backslash – entire command should be on a single line):
VBoxManage sharedfolder add “JeOS” -name “share” \
-hostpath /home/your/shared/folder
- Install the necessary tools to compile the kernel modules that are a part of the Guest Additions:
sudo apt-get install gcc make build-essential linux-headers-`uname -r`
- Mount the Guest Additions iso. First, make sure it is set on the vm’s cd device. Then, simply run this command:
mount /dev/cdrom
- Install the Guest Additions. Please note the specific file run may be different depending on whether the guest OS is 32-bit or 64-bit. Here is the command for 64-bit:
sudo /media/cdrom/VBoxLinuxAdditions-amd64.run
- Reboot the system:
sudo reboot
- Make the directory which will be the target of the share mount:
mkdir /home/your/target/folder
- Mount the share (share – name of shared folder):
sudo mount -t vboxsf share /home/your/target/folder
Voila! The share is now mounted in JeOS. I ran this on an Ubuntu 9.10 Karmic Koala 64-bit host, Ubuntu 9.10 Karmic Koala JeOS guest on VirtualBox v3.1.2. For the purposes of my vm, I did not want a compiler left on the system; thus, I removed everything I installed with this command:
sudo apt-get purge gcc make build-essential linux-headers-`uname -r`
Here is the list of guides I referenced in figuring out the process: