[solved] Migrate Win10 guest .vdi when upgrading host

Discussions related to using VirtualBox on Linux hosts.
Post Reply
wbwb
Posts: 18
Joined: 28. Mar 2011, 08:01
Primary OS: openSUSE
VBox Version: OSE other
Guest OSses: WinXP

[solved] Migrate Win10 guest .vdi when upgrading host

Post by wbwb »

Hi,

I'm upgrading my linux host from OpenSuse version N to version N+x. In doing so I'll also be swapping SSDs. The rest of the hardware remains the same.
Within the old linux OS version N there is a Win10 guest running using virtualbox.

Now my question is, if it is allowed/possible to 'migrate' the Win10.vdi disk, which has been setup under the old OS onto the new SSD and use it as a guest from within the new linux OS and its corresponding new virtualbox version?

At Dr. Google's I found some vague statements about 'removing' the *.vdi from a given machine, copying it to a new location, and then reconnecting the *.vdi back to the SATA controller of virtualbox.
Is there some sound and tested step-by-step instruction for how to do this properly? If yes, I would very much appreciate somebody explaining this in some detail, or pointing me to some appropriate docs.

Most worrisome for me, even if there is a proper way to migrate the *.vdi, would licensed software, like Win10 itself, let alone MSOffice and others, keep running properly? Or would such software 'somehow' (eg. because of a change of the virtual MAC address) evaluate the migration as 'being copied' to different hardware and stop working?

Thx for your help,
wbwb
Last edited by wbwb on 11. Feb 2020, 01:28, edited 1 time in total.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Migrate Win10 guest .vdi when upgrading host

Post by scottgus1 »

wbwb wrote:my question is, if it is allowed/possible to 'migrate' the Win10.vdi disk
Absolutely, though just migrating the disk file is not the way to do it.
wbwb wrote:would licensed software, like Win10 itself, let alone MSOffice and others, keep running properly? Or would such software 'somehow' (eg. because of a change of the virtual MAC address) evaluate the migration as 'being copied' to different hardware and stop working?
Yes it would stop, or at least deactivate, if you just brought the disk file and built a new guest to attach the disk to.
wbwb wrote:At Dr. Google's I found some vague statements about 'removing' the *.vdi from a given machine
You need to get a second opinion. :lol:

A simple file-copy of the guest folder, with the guest .vbox file, Snapshots and Logs folders, and the guest virtual disk file(s), is the best way to copy a guest. The copy can be 'FC' file-compared on local backup media, or hashed for offsite media, to confirm the copies. Note that if the disk file is not in the guest folder next to the guest's .vbox file, the path to the drive file in the .vbox file is absolute, and the full path needs to be duplicated on the new host, or the .vbox file needs to be manually edited. (Not to mention Windows, Linux & Mac paths are not compatible with each other, and I would guess the same about Solaris hosts.) If the guest drive file is in the guest folder with the .vbox file, the path is relative, and the guest can be dropped onto any capable & properly-set-up host, any supported host OS. The guest folder can easily reside on any host drive. It is not difficult to manipulate a guest into the optimum format on whatever drive you want it to exist. If you would like to do this, please let us know.
wbwb
Posts: 18
Joined: 28. Mar 2011, 08:01
Primary OS: openSUSE
VBox Version: OSE other
Guest OSses: WinXP

Re: Migrate Win10 guest .vdi when upgrading host

Post by wbwb »

scottgus1 wrote:A simple file-copy of the guest folder, with the guest .vbox file, Snapshots and Logs folders, and the guest virtual disk file(s), is the best way to copy a guest.
Pls. let me try to understand this a little better. Regarding virtualbox, the directory structure on the old host starts beneath a .VirtualBox folder and contains the following

Code: Select all

.VirtualBox
├── compreg.dat
├── selectorwindow.log
├── selectorwindow.log.1
├── VBoxGuestAdditions_5.1.32.iso
├── VBoxGuestAdditions_5.1.34.iso
├── VBoxGuestAdditions_5.1.36.iso
├── VBoxGuestAdditions_5.1.38.iso
├── VBoxGuestAdditions_5.2.18.iso
├── VBoxGuestAdditions_5.2.22.iso
├── VBoxGuestAdditions_5.2.24.iso
├── vbox-ssl-cacertificate.crt
├── VBoxSVC.log
├── VBoxSVC.log.1
├── VBoxSVC.log.10
├── VBoxSVC.log.2
├── VBoxSVC.log.3
├── VBoxSVC.log.4
├── VBoxSVC.log.5
├── VBoxSVC.log.6
├── VBoxSVC.log.7
├── VBoxSVC.log.8
├── VBoxSVC.log.9
├── VirtualBox.xml
├── VirtualBox.xml-prev
├── VMs
│   └── Win10
│       └── Win10.vdi
├── Win10
│   ├── Logs
│   │   ├── VBox.log
│   │   ├── VBox.log.1
│   │   ├── VBox.log.2
│   │   └── VBox.log.3
│   ├── Win10.vbox
│   └── Win10.vbox-prev
└── xpti.dat
Did I get you right, that you are suggesting to simply copy this complete .VirtualBox directory to the new SSD?
If so, I have some questions:

a) Installing a new virtualbox on the new SSD under the host's new Opensuse version will certainly generate its own .VirtualBox directory. This may contain 'stuff' even prior to setting up any guest. Would it really be safe to simply swap this with my old .VirtualBox directory?

b) Setting up a guest, one usually has to tweak several things, like base/video memory, shared folders, a.s.o.. Are such things encoded 'somewhere' within the content of the original .VirtualBox directory which I would be copying, or would I have to reconfigure the guest's settings on the new host? And if it is the latter, can I then get into trouble if I do not match exactly the settings from the old virtualbox (eg. the MAC address)
scottgus1 wrote:Note that if the disk file is not in the guest folder next to the guest's .vbox file, the path to the drive file in the .vbox file is absolute, and the full path needs to be duplicated on the new host, or the .vbox file needs to be manually edited....If the guest drive file is in the guest folder with the .vbox file, the path is relative, and the guest can be dropped onto any capable & properly-set-up host, any supported host OS....
Hmm. I'm lost :?: Sorry. If you look at my preceding directory structure, which of your comments does apply in what sense?

wbwb
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Migrate Win10 guest .vdi when upgrading host

Post by scottgus1 »

Ok, you have a .vbox file for your guest, so this is going to be fairly easy.

Normally the .Virtualbox folder (commonly 'C:\Users\{yourusername}\.Virtualbox') contains global settings for Virtualbox, and the guests usually sit in another folder, typically 'C:\Users\{yourusername}\Virtualbox VMs'.

I suspect that someone has set the 'another' folder for new guests in the .Virtualbox folder along with the global settings. That can confuse some troubleshooting steps that might be taken with various problems.

Your guest's folder is the '.Virtualbox\Win10' folder with the 'Win10.vbox', 'Win10.vbox-prev' and 'Logs'. The guest disk file is in the '.Virtualbox\VMs\Win10' folder. The best thing is to have the disk file in '.Virtualbox\Win10' along with the Win10.vbox file.

Make sure the guest is completely shut down. You are going to remove the guest disk file from the guest without deleting anything, reposition the guest's disk file into the guest folder, then reconnect the guest disk in Virtualbox.

First make a complete copy of all of the guest files to different backup media, just in case something goes wrong. Copy the '.Virtualbox\Win10' folder and all files therein to your backup media. Also copy the '.Virtualbox\VMs\Win10' folder with the guest disk file to your backup media. I would take the time to confirm the backup copies with an 'FC' file-compare if the guest is really important. Disconnect the backup media and set it aside.

In the main Virtualbox window, open the guest's storage settings. Remove any ISO's mounted in the virtual CD drive(s). Take careful note of which port the guest's virtual disk is attached to - you are going to disconnect the disk and it needs to go back exactly where it was later. You do not need to remove the controllers themselves, just right-click the disk and choose "Remove Attachment". Close the Settings window.

Open the File menu, then the Virtual Media Manager. Find the guest's disk file name in the list and select it. Click "Remove" in the toolbar (if the button is highlighted), then in the pop-ups click the 'Remove' button then the 'Keep' button. (Do NOT click 'Delete', a delete is permanent with no recovery, except to copy from the backup.) The guest disk file will disappear from the list, but is still present on your computer's physical drive. Close the Virtual Media Manager, and the main Virtualbox window.

Move the guest disk file 'Win10.vdi' into the '.Virtualbox\Win10' folder, next to the guest .vbox file. You should have the Logs folder, the .vbox and .vbox-prev files, and the virtual disk all in the '.Virtualbox\Win10' folder. (BTW, if a guest has ever been snapshotted or save-stated, there will also be a Snapshots folder along with the .vbox and Logs.)

In the main Virtualbox window, open the guest's Storage settings, click the correct controller and click the icon that has the popup saying "add hard disk". Click 'Choose an existing disk', browse to '.Virtualbox\Win10\Win10.vdi' and choose it. Make sure the disk is back on its correct controller port.

Your guest should now all be contained in the 'Win10' folder under '.Virtualbox' and should run just fine. The '.Virtualbox\VMs\Win10' folder should be empty and unnecessary, and can now be recycled.

At this point the guest should be able to start on the old host.

With the guest fully shut-down, you should now be able to copy just the 'Win10' folder in '.Virtualbox' to a new host, register the .vbox file, and the guest should start right up. Don't copy the whole .Virtualbox folder, just the 'Win10' folder.

Backups will involve shutting down the guest and copying the 'Win10' folder to other media. Restoring would be shutting down the guest and copying the backed-up 'Win10' folder back over the top of the 'Win10' folder on the original drive.
wbwb
Posts: 18
Joined: 28. Mar 2011, 08:01
Primary OS: openSUSE
VBox Version: OSE other
Guest OSses: WinXP

Re: Migrate Win10 guest .vdi when upgrading host

Post by wbwb »

Thx so much. I really appreciate, even if I'm not fully there ... yet.
scottgus1 wrote:In the main Virtualbox window, open the guest's storage settings. Remove any ISO's mounted in the virtual CD drive(s)...
My guest's storage setting looks like in the 1st attachments. Do you mean I should only remove the *.iso from within there, or also the *.vdi?
scottgus1 wrote:Open the File menu, then the Virtual Media Manager. Find the guest's disk file name in the list and select it. Click "Remove" in the toolbar (if the button is highlighted)...
Well, at present this button remains grey - see 2nd attachment. Could this be, because I should remove also the *.vdi from the guest's storage setting?

Moreover, while I'm at it, in the Virtual Media Manager there is also a tab for Optical disks. In my case this contains a bunch of VBoxGuestAdditions_x.y.z.iso. Should I also "Remove" them?

wbwb
a1.png
a1.png (46.62 KiB) Viewed 1311 times
a2.png
a2.png (47.83 KiB) Viewed 1311 times
a3.png
a3.png (81.64 KiB) Viewed 1311 times
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Migrate Win10 guest .vdi when upgrading host

Post by scottgus1 »

wbwb wrote:Do you mean I should only remove the *.iso from within there, or also the *.vdi?
Remove both.
wbwb wrote:this button remains grey... because I should remove also the *.vdi
Correct. Or you can click Release, then Remove.

You have connections to lots of old Guest Additions ISOs. Release and remove all of them except the version matching the Virtualbox version you have installed.
wbwb
Posts: 18
Joined: 28. Mar 2011, 08:01
Primary OS: openSUSE
VBox Version: OSE other
Guest OSses: WinXP

Re: Migrate Win10 guest .vdi when upgrading host

Post by wbwb »

Yippeee! I mustered all my little courage, followed the advice, did the migration ... and it seems to work :D

Kudos

wbwb
Post Reply