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'm not sure what search term to use and skimming through the VirtualBox manual didn't help me either, so I ask my two questions here...

My setup is this: PC with dual boot into Windows 7 and a Debian operating system (both 64bit). I've created a virtual machine (Kubuntu, 64bit) under Windows and put it's VDI file on a SMB share of my NAS.
Then I created a VM under linux using the same settings for memory etc and assigned the existing VDI file to it. My idea was that I could use that virtual machine from Windows and Linux as well. (1) Is this generally something that should work without problems?

I noticed that snapshots get me into trouble because they appear to be not visible from the other operating system: The snapshots I took after installing the guest system are not visible under Linux. That's why I shut down the VM after usage and not save its state while it's running.

My current problem is this: I have used the VM under Windows first, then under Linux. Now it will only start on Linux. When trying this on Windows the guest OS detects some kind of hard disk error and fails to boot because it cannot mount its drive. Obviously the virtual hard disk won't fail so it must have something to do with me using it under Linux.
(2) How can I fix that?
Update: It also looks like any changes I made in the VM under Linux have been reset by trying to boot it under Windows. Looks like it's back to the latest snapshot. I'm confused...

Update

The answer to my first question can be found below. In short: It works, as long as you don't use snapshots.

The answer to my second question is this: Under Windows set the VM back to the latest snapshot and then discard the snapshot so it gets merged. There should be no snapshots left at the end. If you have multiple snapshots, discard the earliest ones first (Snapshot 1, then 2, 3, ...). I'm not sure what happens if you start at the end (.., 3, 2, 1).
This of course leads to some data loss since you revert all changes since the last snapshot. But at least the VM is usable again.

share|improve this question

4 Answers 4

up vote 9 down vote accepted

Yes, you can share the VDI file as you're doing because you've only got one instance of VirtualBox accessing the VDI file at a time.

However, there is another caveat that you should take into consideration - you cannot share VDI files once you create a snapshot.

Even though this thread is a little old, it should give you a reasonable understanding of why you cannot share a VDI file once you've created a snapshot.

So, avoid snapshots and you should be able to share your VDI file between your Windows and Linux installations.

share|improve this answer
    
Is there a way to recover once you have shared a vdi with a snapshot? –  opensourcechris Oct 29 '13 at 17:39

To amplify what Convict said, don't use snapshots, just close the VM and "Save state". That saves all changes back into the VDI file itself.

If you need to perform the equivalent of snapshotting, you can make an actual copy of the VDI file. Takes up some disk space of course, but disk is cheap.

share|improve this answer

To correct some of the miss information on this post.

  • You can share a single to VDI (disk image) between multiple machines.
  • These machines can ALL be running at the same time, with divergent changes.
  • They can all also take advantage of Snapshotting.
  • Even after a snapshot has been taken you can branch and spawn new machines from any point in a machines history.

I wrote a post a while back just for this...

http://blog.mrverrall.co.uk/2010/06/spawning-many-virtualbox-machines-from.html

Also see the previous post on "Cloning VMs with Multiple Snapshots in VirtualBox" Which would have got around the original posters main issue... i.e. moving a machine, snapshots and all to a new OS.

:)

share|improve this answer
    
I'm not sure if I understand correctly: Making the disk immutable and then turning auto-resetting off, will efectively create two branches. One for my windows VM and one for my Linux VM; right? My goal was to have a "single branch" (trunk?) but that did not work because the Windows installation of VirtualBox did not see the snapshots taken with the Linux version and vice versa. –  foraidt Jun 25 '10 at 8:21

Maybe you should try to go to "File"->"Preferences" and on "General", change the "Default Machine Folder" to your SMB share. Like that the snapshots are saved in the share and available to both OS. Not tested.

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.