alternatively use same VM's from 2 Linux hosts on same PC

This is for discussing general topics about how to use VirtualBox.
Post Reply
ingo2
Posts: 192
Joined: 28. Feb 2008, 14:15
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: OS/2, WinXP-10, Linux
Location: Germany

alternatively use same VM's from 2 Linux hosts on same PC

Post by ingo2 »

I already searched the forum here for my question and just found that it may work, but is not recommendet.

My setup here:
2 Linux-systems as host on same PC (different partitions), Hardy-amd64 and Lucid-amd64. On both systems the same VBox-Version 3.2.8 is installed. (Background is I want a smooth migratin from Hardy -> Lucid).

My VM's: Machines and Disk-images reside on a separate data partition which is jointly used by both host-systems, mounted in the same location

Code: Select all

~/data/VirtualBox
Will it be safe to access the VM's alternating from either of both host-systems?
Which files do I have to copy over from ~/.VirtuaBox?

FYI: exporting and importing the VM's as an appliance works fine without any problems, however snapschots get lost/merged - that's why I ask this question.

With best regards,
Ingo
ingo2
Posts: 192
Joined: 28. Feb 2008, 14:15
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: OS/2, WinXP-10, Linux
Location: Germany

Re: alternatively use same VM's from 2 Linux hosts on same PC

Post by ingo2 »

Today I migrated all my VM's including configuration from Hardy to Lucid:

both systems reside on the same PC/hardware
all VM-configuration and vdi's + other files are located on a separate partition which is accessed under same path on both systems.
both versions of VBox are identical v3.2.8-amd64

I just had to copy over these 2 configuration files in ~/VirtualBox:
VirtualBox.xml
VirtualBox.xml-prev

All machines show up in the VBox-application and all works fine as before including existing snapshots, configuration ...

I will not use the machines alternating with the one or other system (Hardy or Lucid), because I am not sure what happens.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: alternatively use same VM's from 2 Linux hosts on same PC

Post by Sasquatch »

I have a similar set up working just fine. I have my VMs on my external hard drive (which is internal for my PC) and have linked VB to use that location. You can use the variable VBOX_USER_HOME, but I just symlinked /media/VMs/Virtual\ Machines (location of my VMs) to ~/.VirtualBox (default VB settings folder). The settings of course have the correct location for machines and hard drives, though this no longer matters (first, I only linked the xml file, but with the backup system that solution is broken).

So in the end, my situation is that VB looks in ~/.VirtualBox/VirtualBox.xml for the configuration that tells VB to look in /media/VMs/... for the VM configuration. Works like a charm to have the same VMs, snapshots and all, running between my laptop and PC. The same can be done with a dual boot.

My post is a bit messy now that I reread it, but if you have any questions, just ask.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
ingo2
Posts: 192
Joined: 28. Feb 2008, 14:15
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: OS/2, WinXP-10, Linux
Location: Germany

Re: alternatively use same VM's from 2 Linux hosts on same PC

Post by ingo2 »

Hi Sasquatch,

many thanks for your reply. Now I tried to move the local configuration in ~/.VirtualBox to a common external partition (which is mounted under ~./data/VirtualBox by:

move local VirtualBox.xml to the external location

Code: Select all

mv ~/.VirtualBox/VirtualBox.xml ~./data/VirtualBox/  
and creating a symlink back to the origiginal local location:

Code: Select all

ln -s ~/data/VirtualBox/VirtualBox.xml ~/.VirtualBox/VirtualBox.xml
This worked once: I could start my VM's as before, but on terminating VBox I noticed that my symlink had been overwritten by the (newly created) file itself. So all was back to the state as before. Do you have any explanation, or did I miss something?

At this occasion I would like to understand things regarding configuration better. Could you please explain what actually are those 4 files in ~/.VirtualBox for:

a) compreg.dat

b) xpti.dat

c) VirtualBox.xml

d) VirtualBox.xml-prev

Seems that both VirtualBox.xml* files carry the same timestamp and both get refreshed with every use of VBox?

With best regards,
Ingo
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: alternatively use same VM's from 2 Linux hosts on same PC

Post by Sasquatch »

I stated before that symlinking the file only worked before 3.2, now it doesn't any more so I just link the whole folder instead.
File explanation:
a) no idea, doesn't seem to matter if it's removed.
b) same as a).
c) The main settings file. Everything is stored here: VMs, registered media and settings. VM specific settings have their own of course.
d) This is the backup file of c). c) is renamed to this and a new file is created: d).

Due to the new backup system, your symlink will get replaced by a file, two subsequent starts of VB means no more symlink. Since you use a dual boot, this is something you don't want because the file will get out of sync. Hence the symlink of the entire folder instead.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
ingo2
Posts: 192
Joined: 28. Feb 2008, 14:15
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: OS/2, WinXP-10, Linux
Location: Germany

Re: alternatively use same VM's from 2 Linux hosts on same PC

Post by ingo2 »

Many THANKS, it works fine with symlinking the folder!

Thank you also for the explanation about how backup of VirtualBox.xml is performed - so I finally understand what and why I do that.
Now the only thing I have to take care of course is that VBox-versions on both systems are the same, to avoid any unforseen trouble.

Have a nice evening,
Ingo
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: alternatively use same VM's from 2 Linux hosts on same PC

Post by Sasquatch »

That's easily done by adding the repo for the PUEL version. When a new major version is released, you upgrade it on the other system before you start a VM.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
ingo2
Posts: 192
Joined: 28. Feb 2008, 14:15
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: OS/2, WinXP-10, Linux
Location: Germany

Re: alternatively use same VM's from 2 Linux hosts on same PC

Post by ingo2 »

Sasquatch wrote:That's easily done by adding the repo for the PUEL version.
That's what I have already configured since long time ago.

The only thing I noticed is that compreg.dat and xpti.dat get written new every time I cange from one system to the other and there are diff's. So these files appear to contain some information on the host? Would be nice to know what they are used/intended for - just to understand.

Before I configured "switching hosts" they carried the date of installation (or last upgrade) of VBox.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: alternatively use same VM's from 2 Linux hosts on same PC

Post by Sasquatch »

If you want a quick answer, browse the source code and see where it gets created and what for. I really have no idea what they do and what information is in them.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply