Thursday, July 31, 2008

Imaging a real Windows 98 box into a VM

Hopefully this will help others who try this. If this rambles, realize that you're getting the short version. :)

Like in lots of families, my son has an older machine, an old hand-me-down. It's a 533 MHz Celeron with 255MB of RAM running Windows 98 and can, barely, browse the modern web.

I recently upgraded my home Linux server, putting it into the shell of a my Windows XP desktop that was a few years old. (The machine is great, but I'm just not using it with my laptop.) It's 1.8 GHz with 512MB of RAM. It just sits around serving up files, and I don't use its console at all. So this should be usable by my son to run a VM, and I think at a better quality.

Lots of people in person and on the Internet recommend VMware's p2v program, which had been replaced with VMware convertor. It's "experimentally supported" on Windows 98. I tried several times to install version 3.0.3 and 3.0.2 update 1. Both would be installed 99% of the way and then the installer would unwind everything, without explanation of failure. I even tried installing on my laptop and then transferring the files over. I didn't expect this to work, and it didn't. So much for the Convertor.

So, down into the bits. I boot the Windows 98 machine with a SystemRescueCD (using a version that is a few years old), and transfer an image over to my server.

% dd if=/dev/hda1 | ssh -p 3022 dweber@192.168.33.40 dd of=disk.img

One tough thing to figure out was all of VMware's software, and I can't tell which are free easily. My server already had a very old copy of VMware Workstation, which I used to create a virtual machine. The options for a disk were to create a new virtual disk, use an existing one, or use a physical file system.

That physical file system option intrigured me for a while, since in theory I had the entire filesystem transferred over. But this option only seems to work with an actual 100% physical system, like /dev/hda3. So scratch that.

I don't really have an option for "importing a disk image." But I've got a plan. I make a new disk.

This VMware Workstation is so old that I can't even compile the VMware modules. It's not used to where Linux's latest kernel source file layout works, and I spent quite some time trying to figure out if I could outsmart it, with the help of web searches on my error messages.

Well, the answer was to load up VMware Player, which is free. I boot up my VM with the same SystemRescueCD in its CDROM drive. Start up sshd, and then I go my server and transfer the image back.

% dd if=disk.img | ssh root@192.168.162.100 dd of=/dev/hda1

I rebooted and the machine wouldn't book. Which was pretty obvious: I never set up an MBR. D'oh.

Okay, so I go back to that first dd command and do the whole thing again, this time with /dev/hda instead of /dev/hda1. I only transfer over the first 4GB of the disk, because I don't really care that much about everything working, just something, especially the start.

Now I was able to get a boot, but there were repeated disk errors. Probably because I transferred to a disk that wasn't of the same configuration of cylinders, heads, and sectors.

dd2vmdk looks like an awesome tool for changing the raw disk image into a vmdk file that VMware can use. The how-to screens gave me hope, but the tool is busted. :(

I made a brand new VM, this time with files that I downloaded thanks to the instructions at swap zone, and the URLs to vmdk and vmx files it had. These were invaluable, especially because it told me how to get the precise cylinder/head/sector information from the first disk and build it up on the second. Those instructions talk about using a raw disk, but I just needed to create an dumb image file instead of that. The VMDK spec from VMware helped to understand all the syntax.

(One really tricky bug that I ran into was that I was geting an error message saying "File not found: windows.vmdk". Eventually I figured out that it wasn't having trouble finding windows.vmdk, but rather that some file referred to by the vmdk file was missing.)

So now I finally had a correct VM built. I booted back into a rescue CD, and transferred in the disk image in chunks. (I only had 1 rescue CD, so I moved 20 GB from the Windows 98 machine to my server, and then from the server into the VM. As I type this I realize I could've just created an iso file with dd and skipped that step. Oops. If you do it all at once, you don't have to learn the difference between "skip" and "seek" in dd.)

I booted up and got a VM! It's Windows 98! yay!

Things were slow as puke and the graphics sucked, and I couldn't install VMware Tools with VMware Player. So I looked around VMware site some more and saw that VMware Server is free. I probably should have done this part long ago.

Once that installs, and VMware tools installs, I finally have a good running Windows 98 System.

Oddly, I probably gave the system too much RAM, because at 196 MB it was swapping my server. So I dropped it back down to 128 MB and things ran faster. His UB Funkeys, instead of crawling like a legless dog, now crawls like a two-legged dog. Well, it still feels faster to him, and now he has a better video card, too.

If I could send a message back to myself two weeks ago, I would say:

  • just use VMware server, it's free and full-featured
  • download the .vmx and .vmdk files from swap disk
  • get a second rescue CD, or image the first
Happy imaging!

2 comments:

  1. Anonymous12:07 PM

    I am looking for a windows 98 vmdk image. Do you know where I am get one that is already set up, is 1GB or less in size? I went to the swap site you suggested, but I could not find a download link for this.
    Any Help Would Be Appriciated!
    Thankyou.
    Sincerely, Red.
    ---My email is night_shadow_@hotmail.co.uk if you want to email me.

    ReplyDelete
  2. I wanted to actually try this but before that I found your blog and reading it and got really helpful information..

    ReplyDelete