Can I use one virtualbox disk for multiple machines?

Posted by mxp on Super User See other posts from Super User or by mxp
Published on 2009-11-09T23:09:21Z Indexed on 2010/03/24 11:03 UTC
Read the original article Hit count: 204

Filed under:
|
|
|
|

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.

© Super User or respective owner

Related posts about Windows

Related posts about linux