Monday, March 07, 2022

Transferring files into a FreeDOS VM on Proxmox

After finally managing to install FreeDOS onto Proxmox, the next step was to copy in the DOS games that I have. This proved to be just as challenging...

First, I tried to create an image file with all the DOS games in them:
1. Create an empty 12GB image
dd if=/dev/zero of=dosgames.img bs=1024M count=12
 
2. Make a FAT32 partition
mformat -F -i dosgames.img
 
3. Copy everything inside my DOS games directory into the image file
mcopy -s -i dosgames.img /home/mygamesdirectory ::
 
However, that didn't work because it lacks a proper partition table and cannot be mounted into FreeDOS.
So, after formatting in FAT32 using step 1, I ran:
4. Create a primary partition using fdisk
fdisk dosgame.img
before going to step 3. Still didn't work. It would not mount it properly as a drive, and if I tried to mount the image file as a CD-ROM, it would fail to recognise it.

I tried replacing step 1 with qemu-img instead by
7. Create disk image file using qemu-img
qemu-img create dosgames.img 12G
and then repeating steps 4 and 3, but that didn't work too.

Then I thought about transferring via the network. But FreeDOS's networking support is... well, DOS level. It requires some work to get things done. I had wanted to try to use SMB share to transfer the files onto the FreeDOS VM, but setting up SMB on FreeDOS looked like a challenge. (Another link to how to use MS Client 3.0 with FreeDOS) Instead, I installed the networking packages using FDIMPLES, and followed the instructions here to run an FTP server within the VM that can be accessed from outside. There were some changes in commands, though. For example, to start network services, I used
\FREEDOS\BIN\FDNET.BAT
and to start the FTP server, it was
\NET\FTPSVR

This started up the FTP server within the FreeDOS VM, but trying to transfer gigabytes of files over to the server took a lot of time, so I gave up.

Finally, I came upon making a CD-ROM ISO file using mkisofs by
mkisofs -o dosgames.iso /home/mygamesdirectory
This command takes the entire content of mygamesdirectory and turns it into an ISO file called dosgames.iso. I could then upload this ISO file to the server (usual way of uploading ISOs via the Proxmox web UI) and mount it as a CDROM drive.
 
This allowed me to then use xcopy to copy all the files into a directory on C drive.
a. Make a directory for DOS games
md dosgames
b. Go into that directory
cd dosgames
c. Use xcopy to recursively copy all file from D drive into the current directory
xcopy d: /e
 
Finally!
 
Next is to see if the games even run... 
(maybe need set BLASTER=A220 I5 D1 H5 T6 P330 in AUTOEXEC.BAT)
(Next is to try on my normal Linux machine...
qemu-system-x86_64 -name FreeDOS -machine pc-i440fx-4.2,accel=kvm,usb=off,dump-guest-core=off -enable-kvm -cpu host -m 256 -overcommit mem-lock=off -no-user-config -nodefaults -rtc base=utc,driftfix=slew -no-hpet -boot menu=on,strict=on -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny -msg timestamp=on -hda cdrive.raw -cdrom dosgames.iso -device sb16 -device adlib -soundhw pcspk -vga cirrus -display sdl -usbdevice mouse
to see if this works...)
(Above from this link. Plus the ebook may help. And this link too.)

P.S. I am kind of sure my final conclusion will be... use DOSBox... 😅

Afternotes:
There is also the method where you mount the disk image on the host system and transfer files into it, detailed here.

No comments: