Mount Windows Shared Folder as VirtualBox Linux VirtualHost
Back to Blog

Mount Windows Shared Folder as VirtualBox Linux VirtualHost

Wed, 26 Jun 2013, by Syrsly
If you want to use a Linux virtual machine (VM) for use as a testing environment for your web projects yet also want to edit the files from the comfort of your Windows computer, there are many caveats that could slow you down.  First, VirtualBox does not allow you to do a reverse shared folder.  There are some tricks which could simulate such functionality, but I found them confusing and never managed to get a working example.  A better alternative was to load your shared Windows folder as the web server's base directory.  Here is the command you should use:
sudo mount -t vboxsf -o uid=1000,gid=1000 name_of_shared_folder /var/www/name_of_linux_directory
That's pretty much it.  You will need to restart the apache server afterward.  Here's how I do that in Ubuntu:
sudo /etc/init.d/apache2 restart
Very simple.  I think that is all you have to do.  Just remember that the commands above have to be run every time you start the VM.  You could add these commands into a start-up script to avoid that, but I will not cover that right now, because I could not recall how to set one of those up. If I feel the need to make one later, I'll be sure to add the additional info to this post.  I hope the information already provided helps you along, though.  Cheers.
This post not yet tagged.