Page 1 of 1
alternatively use same VM's from 2 Linux hosts on same PC
Posted: 24. Aug 2010, 19:54
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
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
Re: alternatively use same VM's from 2 Linux hosts on same PC
Posted: 2. Sep 2010, 20:31
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.
Re: alternatively use same VM's from 2 Linux hosts on same PC
Posted: 2. Sep 2010, 22:17
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.
Re: alternatively use same VM's from 2 Linux hosts on same PC
Posted: 3. Sep 2010, 12:54
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
Re: alternatively use same VM's from 2 Linux hosts on same PC
Posted: 3. Sep 2010, 20:23
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.
Re: alternatively use same VM's from 2 Linux hosts on same PC
Posted: 3. Sep 2010, 22:14
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
Re: alternatively use same VM's from 2 Linux hosts on same PC
Posted: 3. Sep 2010, 22:20
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.
Re: alternatively use same VM's from 2 Linux hosts on same PC
Posted: 3. Sep 2010, 22:49
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.
Re: alternatively use same VM's from 2 Linux hosts on same PC
Posted: 4. Sep 2010, 10:57
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.