Question

I would like to have a VM to look at how applications appear and to develop OS-specific applications, however, I want to keep all my code on my Windows machine so if I decide to nuke a VM or anything like that, it's all still there.

If it matters, I'm using VirtualBox.

Was it helpful?

Solution

This is usually handled with network shares. Share your code folder from your host machine and access it from the VMs.

OTHER TIPS

Aside from network shares, another tool to use for this is a version-control system.

You should always be able make a normal network connection between the VM and the hosting OS, as though it were another computer on the same network. Which, in some sense, it is.

I do this all the time. I have a directory in a Windows drive that I mount in my host ubuntu 12.04. I run virtualbox ubuntu 13.04 as a guest. I want the guest to mount the Windows directory with full non-root permissions. I do almost all my work from a bash shell, so this method is natural for me.

When searching for methods to automatically mount virtualbox shared folders, reliable and correct methods are hard to distinguish from those that fail. Failures include getting and setting permissions, as well as other problems.

Methods that fail include:

  • modifying /etc/fstab
  • modifying /etc/rc.local

I am fairly certain that rc.local can be used, but no methods I have tried worked. I welcome improvements on these guidelines.

On virtualbox 4.2.14 running nautilus (bash terminal) on an ubuntu 13.04 guest, Below is a working method to mount Common (sharename) on /home/$USER/Desktop/Common (mountpoint) with full permissions. (Note the ‘\’ command continuation character in the find command.)

First time only: create your mountpoint, modify your .bashrc file, and run it. Respond with password when requested. These are the four command-lines needed:

mkdir $HOME/Desktop/Common
sudo echo “$USER ALL=(ALL) NOPASSWD:ALL” >> /etc/sudoers
find $HOME/Desktop/Common -maxdepth 0 -type d -empty -exec sudo \
mount -t vboxsf -o \
uid=`id -u $USER`,gid=`id -g $USER` Common $HOME/Desktop/Common \;
source ~/.bashrc # Needed if you want to mount Common in this bash.

All other times: simply launch a bash shell.

The find command mounts the shared directory if the mountpoint directory is empty. If the mountpoint directory is not empty, it does not run the mount command.

I hope this is error-free and sufficiently general. Please let me know of corrections and improvements.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top