VirtualBox Helpful Links
I was setting up some virtual machines in the last few weeks and stumbled upon problems that I’ve encountered before.
Here are some helpful links for when you’re setting up a virtual machine in VirtualBox:
- How to enable symlinks for shared folders in VirtualBox
- How to use modifyvm to resize a VirtualBox hard disk and how to use clonehd to change the virtual hard disk format to one that supports resizing
- modifyvm manual section
- clonehd manual section
- How to install Host-Only networking on Mac OS X
My current setup at work is to have 3 virtual machines running. For networking they all have access to the internet with a bridged adapter and they have access to each other (if needed) through the host-only adapter. For the bridged adapter you would set the network interface to grab a static IP address and then modify the /etc/hosts files of the other virtual machines to use that static IP address. I use port forwarding to make development easier, it compensates for the load-balancing and URL rewriting that happens on a production server (apache/nginx use URL rewriting to point different URLs to different web applications).
I was originally using Shared Folders but the issues with symlinking (which causes problems for NPM (Node.js Package Manager)) and the slower disk read/write speeds were not worthwhile. I ended up setting up a shell script that uses rsync to synchronize my host machines git repositories into the virtual machine. I wrote a function in Emacs for running the rsync script whenever I save files that are in certain directories. It works fairly well, the only issue is that the rsync won’t delete files so you sometimes have to clear out the whole directory and rsync from scratch to make sure it’s up to date (remember to avoid syncing the .git and node_modules from host, and don’t delete the node_modules on the guest machine).
I hope this information is useful for someone in the future!