VHD Problems

emuola
Posts: 87
Joined: Wed Dec 29, 2021 7:14 am
Been thanked: 2 times

VHD Problems

Unread post by emuola »

Running the latest Mister version and having problems with VHD files. If I create a new VHD in Win10 (200MB, FAT, MBR etc.) and upload it to my Mister the system won't see it, e.g. I cannot change to D: etc. On the other hand, if I download this ready-made 2GB VHD file:

It works happily in the Mister, but I cannot attach it in my Win10 as I always get "The file or directory is corrupted and unreadable".

I just want to have one VHD for DOS 6.22 (the file above) and another for games. MisterFS seems to be working very unreliably, so that's why I'm opting for another HDD/VHD for games instead of the shared folder.

What sorcery is this? :oops:

Attachments
DOS622.zip
(5.76 MiB) Downloaded 100 times
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: VHD Problems

Unread post by jca »

I suppose you used Disk Management under Windows to create the VHD. I also suppose you have another VHD on your MISTer mounted as drive C: and bootable. Run FDISK and check that you see the 2nd VHD, display its partition table and see if it gives you some clue as to why you cannot use it.
For the 2GB VHD: it means it has not been created under Windows but under Linux using dd and was later partitioned, formatted, ... under AO486. Such a VHD works perfectly with AO486 but is not a real Windows VHD. A real Windows VHD contains not only the disk image but also some kind of header giving information on the disk itself. A VHD created under Linux as I mentioned above does not contain this header and is not considered as a VHD under Windows, MISTer does not care about the presence of this header. To be able to use such a VHD you have to create a similar empty one under Windows and under MISTer copy everything from the VHD created under Linux to the one created under Windows. At this point your new VHD will be usable both under Windows and MISTer.
emuola
Posts: 87
Joined: Wed Dec 29, 2021 7:14 am
Been thanked: 2 times

Re: VHD Problems

Unread post by emuola »

Thank you for a quick reply jca 👍 Hmm, seems pretty cumbersome. Is there any reasonable way to manipulate (e.g. transfer files in/out) with a VHD file, which was created with DD, under Windows 10?
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: VHD Problems

Unread post by jca »

The only way I know is as I said: create a Windows VHD under Windows. As you had trouble with your own VHD (I would still try to figure out what is the problem if I was you) I would just create the VHD without partitioning, formatting it, ... and upload it to MISTer. Under AO486 I would use FDISK, Format, ... to make it usable. Doing so would bypass the problem you had. I still would try to figure out what is the problem when you do what you did to create it under Windows.
I Am making such a test now with Win7 but it should be the same for Win10.
Control Panel -> Administrative Tools -> Computer Management -> Disk Management -> Action -> Create VHD.
Select the size and select Fixed Size.
Right Click on the left where it says "not Initialized" and select Initialize -> MBR.
Right Click on the disk where it says "Unallocated and select New Simple volume. Format it the way you want.
Detach the VHD and upload it to MISTer.
For my test I booted from a DOS 6.22 floppy and mounted the disk as the first disk.
Type DIR C: and it should be OK. If you want this disk to be bootable you have to use FDISK and set the partition active.
Now you have to install whatever you need ...
Note: you could also not have uploaded the empty disk to MISTer and used a virtual machine to use FDISK, FORMAT, ...
Don't forget: if you want your disk bootable you have to set the Active Partition.
Bas
Top Contributor
Posts: 518
Joined: Fri Jan 22, 2021 4:36 pm
Has thanked: 60 times
Been thanked: 225 times

Re: VHD Problems

Unread post by Bas »

AO486 doesn't use VHD but raw images. Usually that won't matter as long as you don't touch the very last sector from within the core. Windows *does* need a valid data structure there, so that may cause trouble.
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: VHD Problems

Unread post by jca »

What I said is basically the same thing. Using a real Windows VHD has the advantage to have the disk usable both on MISTer and Windows. I guess writing on the last sector would'nt matter on MISTer but the disk would no longer be usable under Windows. I wonder how Windows protects this sector.
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: VHD Problems

Unread post by Malor »

It may be easier to create a blank image file, and then use MS-DOS under the Mister to partition and format it. Once that's done, you need to mount it under Linux (make sure the core is stopped!), and then copy in the misterfs device driver. Once you run *that*, you add the "transfer" directory in the AO486 directory as a drive letter. You can manually copy in whatever you want to transfer on the Linux side, and then copy it again from the virtual transfer drive to the hard drive image.

You can set up FTP access so that you can upload files over the network from Windows, but I generally just copy stuff from the Linux command line using SSH instead. You can wget stuff into transfer, and then copy it onto the hard drive image.
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: VHD Problems

Unread post by jca »

This is the first solution I proposed with a blank disk and doing everything else on MISTer. I detailed the second solution where I did more preparation on the Windows side (even using a VM on Windows to make a fully functional disk) because @emuola had trouble making a formatted disk under Windows and working under MISTer. This does not seems normal and by detailing the steps he may figure out where he messed up.
Now he has several options and I hope one of them will solve his problem as it should.
emuola
Posts: 87
Joined: Wed Dec 29, 2021 7:14 am
Been thanked: 2 times

Re: VHD Problems

Unread post by emuola »

Thank you guys 💪 I got it sorted out my "taking the easy way out" route. I just used a ready-made VHD, file. I still need to find out the reason, but that has to wait a bit.
Bas
Top Contributor
Posts: 518
Joined: Fri Jan 22, 2021 4:36 pm
Has thanked: 60 times
Been thanked: 225 times

Re: VHD Problems

Unread post by Bas »

At least MS-DOS aligns the partitions to the last sector of the last complete cylinder of the disk, as I figured out by testing for it. If your image file isn't exactly aligned to that value, the last sector will never get touched by MS-DOS from within the core and be "protected" by chance. You have a theoretical 1 in 512*63 chance of hitting a snag here, probably 1 in 63 because sector alignment is usually enforced when creating images.

Windows protects that last sector because it knows it is the VHD footer and not a data sector.

This might lead to an off-by-one condition under rare circumstances between software that respects the VHD footer structure, and software that treats it like a sector leading to a difference in geometry calculations.

For this reason I wouldn't rely on VHD and raw images to be interchangeable without issue. They are in the majority of cases, but not all of them.

Post Reply