jmarsh wrote on 2025-04-26, 00:53:
davidmorom wrote on 2025-04-25, 18:20:I made a DOS 6.22 install on DOSBox with 512,63,255,1024 geometry and it worked fine.
Using a size that large is definitely asking for trouble - as I mentioned earlier, DOSBox uses regular buffered file I/O functions (fseek, ftell, fread, etc.) which do not handle file offsets larger than 2GB. Any tool/program that tries to access the drive beyond 2GB will likely fail, in the worst case experiencing an integer overflow that could position the file pointer at the beginning of the file when writing.
That's very interesting, but it would be a global 2GB limit, completely independent from the the geometry. It would be unrelated with the 1023 vs. 1024 cylinders issue we were discussing.
After reading your post, in part for curiosity and in part to have things clearer, I made some extensive testing, and these are the results.
I made a 512,63,255,1024 (8422686720 bytes) image an mounted it, booted DOS 6.22 install disk and the hdd was correctly partitioned and formatted (one 2GB FAT16 partition). After installing DOS, with fdisk I created another 3 2GB FAT16 partitions and formatted them. With WinImage I injected a text file on the last partition, which is past de 6GB barrier, and opened the file inside the emulated machine using EDIT. The file is perfectly accessible.
Now comes the interesting part. The above is true for DOSBox-Staging v0.82.1 and DOSBox-X v2025.02.01 (both 32 and 64 bits). On the old official DOSBox 0.74-3 the hdd is totally inaccessible. To narrow down the issue, I created smaller hdd images dividing the heads number by two. With 512,63,128,1024 (4227858432 bytes) it also failed, but with 512,63,64,1024 (2113929216 bytes) it worked perfectly.
So, as you stated, the original DOSBox 0.74-3 is affected by the 2GB IO limit, you could use any geometry you want as long as the resulting image is smaller than 2GB. But all the up to date variants (Staging and X) are perfectly capable to use hdd images up to 8GB with 512,63,255,1024 geometry.
UPDATE: with DOSBox-X, as it supports LBA, you could go even beyond the 8GB barrier. I created a 16GB image with standard 63,16 geometry (512,63,16,32768 or 16911433728 bytes), partitioned and formatted it with a Windows 98 boot disk, and injected files with WinImage at several positions inside the image. All files are accessible from the emulated machine.