Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a "suite" of 5 VMs I'd like to make, all Ubuntu Server 12.04 guest OSes but with radically different software stacks on top of the OS (one server is a "build server" with Subversion, Hudson, etc. installed on it; another server is an app server with JBoss, etc.).

Installing and configuring Ubuntu Server takes several hours. If at all possible, I'd like to only have to do this once (to get a "base" version of the OS installed on a VM) and then copy this "base" to the other 4. That way I save 2 - 3 hrs per machine and just need to focus on installing and configuring the applications for each server.

When I create a VM, I see three files created:

  • my-vm.vbox - I assume this is the VM
  • my-vm.vbox-prev - No idea what this is
  • my-vm.vdi - I assume this is the actual disk where the guest OS (my "base") is installed

Unfortunately I've already created all 5 VMs, and am in the process of installing Ubuntu Server on the first one, so my setup is like this:

  • build-srv.vbox, build-srv.vbox-prev, build-srv.vdi (the VDI is initialized but has nothing in it)
  • app-srv.vbox, app-srv.vbox-prev, app-srv.vdi (same, initialized, but with nothing in it)
  • etc... (for all 5)

I'm in the process of installing Ubuntu Server on the build server (build-srv). I'm hoping that once I'm finished, all of that configuration info will just be contained to build-srv.vdi. In theory, I should be able to just copy-n-paste build-srv.vdi to each of the other servers, and swap out their respective VDIs, right?

I'm sure I would have to also go into the VM settings and change the VDI somehow as well, but I'm not even sure if I'm on the right track.

Is what I need possible? If so, what do I need to do to configure each VM with the same copy of the OS instance I am currently in the middle of? If not, what are my options (besides repeating the same 2-hour install for each VM!)? Thanks in advance!

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Each VDI file contains an identifier on the form of an UUID.
Virtualbox record these UUIDs into a database, and refuse to use a VDI you just copied (but this is okay on another computer because it doesn't recorder anything about this UUID).

I know 2 methods:
- copy the VDI (with a file manager or command line), then use vboxmanage internalcommands sethduuid "path/yourdisk.vdi" and you'll have a brand new UUID for this VDI
- or use Virtualbox mediamanager (into the menu). Select the disk you want to copy... and click the "copy" button. It will do the same thing with ease

  • my-vm.vbox - this is a XML file describing the VM. You can open it with a text editor or a web browser
  • my-vm.vbox-prev - this is a backup of my-vm.vbox
  • my-vm.vdi - this is the virtual disk

edit : the copy feature seems to be present only on Windows. My Linux box doesn't have it, my Windows box has

share|improve this answer
    
Thanks @Gregory MOUSSAT (+1) - I'm inside the virtual media manager now but not seeing a "copy" button anywhere, nor do I see any reference to it in the manual. Can you provide a screenshot or more info about how/where to access this copy feature? Thanks again! –  pnongrata Aug 21 '12 at 17:12

What you may be looking for is the multiattach disk mode - which can be applied after the initial disk image is created and configured. You can then use it as the core for multiple VMs and each will have thier own differencing image based on the original - no copying or cloning necessary. Please see the docs at: http://www.virtualbox.org/manual/ch05.html#hdimagewrites

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.