Next post: Transfer files on any network

How to transfer files from a Windows 98 VM

In VirtualBox, when I made a Windows 98 virtual machine, it took me a bit of thinking to know how to quickly transfer files in and out of the VM. VirtualBox's "guest additions" do not support Windows 98, so you can't drag/drop files or set up a shared folder. Here's my method!

It looks like people solve this by setting up a SMB share in the guest machine and connecting to it in the host. But I don't want to enable SMB - Windows 98 does not support the safer SMBv2, and SMBv1 has security vulnerabilities that led to ransomware like WannaCry.

I can transfer files into the VM by creating a .iso file and telling VirtualBox to mount it, simulating a CD-ROM. But how to transfer files out of the VM? I do it by using a second, smaller virtual hard drive (vhd file)!


Create a VHD file. In Virtual Box, go into Settings, then into Storage. Right-click on the Controller: IDE and select `Add Hard Disk`.

In the next dialog, create a new vhd. Making a 100Mb fixed-size vhd worked for me, I gave it the name "childhd".


When you start up the VM, your new hard drive won't show up yet - we need to format it!


From within the VM, open the command line.


Type `fdisk` and hit Enter.


It starts out looking at drive 1 (C), so first hit `5` to change the drive we are looking at.


Notice that disk 2 hasn't been assigned a drive letter. Hit `2` so that we can look at drive 2.


Hit `1`, to create a DOS partition.


Hit `2`, create extended DOS partition.


The next screen should look like this. Create it with 100% as pictured.


It worked, the partition was created.


Now back on the first screen, we have a valid drive (D:).


Close the command line and we can see the new drive in Explorer! I'll note that it is the "D" drive.


From within the VM, open the command line again.


Run `format d:` -- assuming the new drive you saw in Explorer was the "D" drive. If asked to enable large disk support, hit Enter to choose the default, yes.


You can now copy files onto the drive! From now on, you don't need to do any of the previous steps, you can keep this vhd and reuse it.


After shutting down the VM, you can find the 100mb vhd file on the hard drive. You can open it in a free program like 7zip (pictured) to extract the files. Done!

 

This method also likely works for Windows 95 and ME.

(Addendum: my molten_file_transfer project would have worked well here, but Python no longer supports Windows 98. When I changed the Network Adapter in Virtual Box's settings to "Bridged Adapter", I was able to ping the guest machine from the host machine, so it is still a viable route if I were to port molten_file_transfer to run on an old version of Python.)