DOS 6.22 only recognizes 500MB disk instead of 2GB?

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.
javispedro
Posts: 58
Joined: 29. Jan 2022, 15:31
Primary OS: openSUSE
VBox Version: OSE other
Guest OSses: Old & New Windows, Linux

Re: DOS 6.22 only recognizes 500MB disk instead of 2GB?

Post by javispedro »

javispedro wrote:Or is it possible the logical geometry is stored on the VDI metadata?
From looking at the source: yes it does, VDI file format can store logical geometry (in addition to physical). Logical geo will be propagated to the emulated CMOS and then picked up by the BIOS.

And the resize code in VD.cpp only enlarges the number of cylinders, never the number of heads:

Code: Select all

            rc = pImage->Backend->pfnGetLCHSGeometry(pImage->pBackendData, &LCHSGeometryOld);
            if (RT_SUCCESS(rc) && (LCHSGeometryOld.cCylinders != 0))
                LCHSGeometryOld.cCylinders = cbSize / 512 / LCHSGeometryOld.cHeads / LCHSGeometryOld.cSectors;
            else if (rc == VERR_VD_GEOMETRY_NOT_SET)
                rc = VINF_SUCCESS;

            pLCHSGeometryNew = &LCHSGeometryOld;
So it should be possible to write a tool that rearranges the logical geometry in the VDI header then fixes the MBR and partitions. Not going to do it, of course :) Just start with a fresh VDI.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: DOS 6.22 only recognizes 500MB disk instead of 2GB?

Post by fth0 »

javispedro wrote:a tool that rearranges the logical geometry in the VDI header
On a Linux host, you can use vbox-img to do just that (but not more).

Additionally, you may be interested in looking at the auto detection code in the file DevPcBios.cpp, functions setLogicalDiskGeometry and biosGuessDiskLCHS.
Post Reply