NoSQL Zone is brought to you in partnership with:

Software developer specializing in MongoDB, Python, Tornado, and Javascript, with particular interests in real-time web and new tools that get the job done with grace and alacrity. A. Jesse Jiryu is a DZone MVB and is not an employee of DZone and has posted 43 posts at DZone. You can read more from them at their website. View Full User Profile

Testing out Some Changes to PyMongo on VirtualBox and Vagrant

05.07.2012
| 1215 views |
  • submit to reddit

When I joined 10gen they gave me a MacBook Pro with an SSD drive. This is wonderful, mainly because it loads StarCraft II really fast. An SSD is like my studio apartment on the Lower East Side: low latency, but a bit cramped. (My apartment is low-latency because it’s a 10-minute walk from work. This is not a strained analogy.)

Lately I’ve needed to spin up a bunch of virtual machines with VirtualBox and Vagrant for testing our changes to PyMongo under every conceivable OS, and there’s no room for them on my SSD. Even if they run heinously slow on a USB drive, they can’t stay in my apartment. Here’s how I moved them to an external hard drive:

  • Move ~/.vagrant.d to the external drive. I renamed it vagrant_home so I’d be able to see it without ls -a.
  • Set VAGRANT_HOME to “/path/to/drive/vagrant_home” in ~/.bash_profile.
  • Open the VirtualBox app, open Preferences, and set its Default Machine Folder to “/path/to/drive/VirtualBox VMs”.
  • Close VirtualBox.
  • Move your “VirtualBox VMs” folder to the drive.
  • Reopen VirtualBox. You’ll see your VMs are listed as “inaccessible”. Remove them from the list.
  • For each VM in your “VirtualBox VMs” folder on the external drive, browser to its folder in Finder and double-click the .vbox file to restore it to the VirtualBox Manager. (Is there an easier method than this?)
  • Finally, move any existing Vagrant directories you’ve made with vagrant init (these are the directories with a Vagrantfile in each) to the external drive. Since these directories only store metadata you could leave them on your main drive, but it’s nice to keep everything together so you could fairly easily plug the whole drive into another machine and start your VMs from there.

Good to go. This has freed up a ton of space on my main drive, and the speed penalty has not been very bad.

Published at DZone with permission of A. Jesse Jiryu Davis, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)