Home » Blog
■ Migrate virtualPC 2007 machines to VirtualBox (and keep the old VHDs)
Every 5 years or thereabouts I switch laptops. The old trusty HP probook hasn't kicked the bucket yet, but it was profusely sweating (cooling fan went crazy) especially running windows 10 in virtual machines, so I thought I'd best retire it before it retired itself in a catastrophic meltdown. The replacement is a Toshiba satellite with SSD. Migrating the development environment to the new laptop is a big job; part of it was the virtual machines
I use for testing xplorer² et al in older windows versions.
The first realization was that virtual PC 2007 won't work on windows 10 x64. I got several warnings from the OS that this would't work; ignoring them proved futile. The installer could not add the Virtual Machine Network Services and trying to start a VM would lead to a BSOD (!). Apparently people have managed to use it but only on 32 bit versions of windows 10. I had to bid farewell to the lightweight and long serving virtual PC 2007. What are the alternatives?
- Microsoft Hyper-V. All windows 10 versions Pro and above come with built in VM support. But in my part of the world, you can only buy laptops from high-street retailers (online shops won't deliver to Cyprus) so I'm stuck with windows 10 Home edition. Imagine the oxymoron, having access to all windows versions though my MSDN subscription, yet being stuck with a basic home version. But that's the hand I was dealt with in life, and hyper-V was ruled out.
- VMWare player. Supposedly this is the best of the bunch but has licensing restrictions. I can't blame them for trying to make a living, but it also took more space for its installation. In the interest of preserving my limited 256GB SSD space, I took a left turn.
- Oracle VirtualBox. So it was down to virtualbox — better the devil you know! With version 5 they finally fixed the drag-drop from host to client, making file transfers even easier. 3 cheers for open source <g>
I had 5 virtual machines in vpc2007: windows 98, 2000, (2x) XP and vista. The all important "hard disks" were in the handy VHD format. Obviously I wanted to reuse these VHDs, since they included windows updates and lots of installed software. When you create a new VM you can instruct Virtualbox to use an existing virtual hard drive file rather than creating a new empty one. The best news is that you can import in VHD format instead of the default VDI type. Almost sorted, except for a couple of snags:
- Virtual machine additions. One of the programs installed in the original VHD was virtualPC 2007's own virtual machine additions tool, that helps with sharing files, clipboard etc. When run inside virtualbox, the mouse pointer disappeared altogether. The advice is to uninstall the old VM additions tool before passing it on to virtualbox. It is also possible to uninstall it after, but with no mouse you must be good with the keyboard to reach add/remove software in the control panel. Doable as a party trick :)
- Throwaway VM usage. VPC2007 had a very useful option that would terminate a VM discarding any changes. You could set a VM to automatically delete changes. I used such VMs as a sandbox, installing software without fear of malware. You do a little test, then press X to wipe clean. You can do something similar in virtualbox, discussed below.
VirtualBox immutable virtual machines
Virtualbox doesn't have a simple way to terminate a VM deleting any changes in the VHD. You can set a disk image to immutable
, but how is that done? This is open source after all, so don't expect any GUI conveniences, and even RTFM won't tell you much. Here's the drill:
- Delete the VM you want to modify (keeping the files)
- Browse the virtualbox installation folder and open a DOS console in it
- In the command prompt type:
VBoxManage modifyhd "c:\path\to\disk.vhd" --type immutable
- Redefine the VM importing the now immutable VHD
If you try to do this with a VHD that is attached to a VM — even if not running — you will find it fails (I lost a couple of hours trying). That's why step 1 is very important. Anyway, open source we said, cheap and cheerful :)
If you don't want to go into this trouble, there is an easier way using snapshots. A snapshot is similar to a restore point; create one, then you can go back discarding any changes, installed programs, viruses and so on. Here are the steps:
- Select the VM and create a snapshot (see the pic)
- Start the VM, do any changes you like, then stop it (shutdown not required)
- Right click on the snapshot and choose Restore. Untick box that offers to save current state.
- Before restarting the VM, delete the snapshot. Don't let snapshots accumulate, because merging 2 or more snapshots takes a long time. That's why step 4 is important.
Snapshots have a little overhead compared to VPC2007, but will give you throwaway VMs for testing.
ps. This is the last blog created on the old HP laptop, retired with honors. No more windows 2000-like window snapshots <g>
Post a comment on this topic »