Large HD images (DOSBOX)

Here you can discuss the development of patches.

Large HD images (DOSBOX)

Postby ykhwong » 2013-2-11 @ 15:55

DOSBox cannot mount ISO images larger than 2GB due to some 32-bit functions (fseek/lseek/...) It is required to update the code in order to use 64bit functions that resolve the capacity limitation.

It led me to create a small patch to fix the issue against the current SVN. In my experiment, I was able to mount 4 gigabytes of hard disk image in DOSBox.
You do not have the required permissions to view the files attached to this post.
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: A patch for mounting hard drive image larger than 2GB

Postby leileilol » 2013-2-11 @ 16:35

What are the limits with the patch, in theory? 110gb?
User avatar
leileilol
l33t++
 
Posts: 8776
Joined: 2006-12-16 @ 18:03

Re: A patch for mounting hard drive image larger than 2GB

Postby ykhwong » 2013-2-11 @ 17:44

leileilol wrote:What are the limits with the patch, in theory? 110gb?


In theory? I don't know, but I think it depends upon the operating system and the file system.

Note that this is experimental and not a complete patch, meaning that it still may have some bugs. I confirmed that booting from my 4gb hdd img also works though.
You do not have the required permissions to view the files attached to this post.
Last edited by ykhwong on 2013-2-11 @ 17:51, edited 1 time in total.
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: A patch for mounting hard drive image larger than 2GB

Postby gulikoza » 2013-2-11 @ 17:51

C/H/S limit is 8GB
User avatar
gulikoza
Oldbie
 
Posts: 1698
Joined: 2004-6-25 @ 14:53

Re: A patch for mounting hard drive image larger than 2GB

Postby gulikoza » 2013-3-13 @ 17:56

Ykhwong's patch is somewhat too aggressive as it changes all fopen functions (you won't need 2gb+ for reading conf, hopefully :happy:), but lacking some other fixes (while 4GB might work, 4GB+ probably won't).

Since I've been doing something similar, I merged both patches + hal's megabuild imgmake. I also added the ability to read (fixed size, not dynamic) VHD images.

I tested the following:
- created a new 8GB VHD image with imgmake c:\dosbox\dosbox.vhd -t hd_8gig (the disk will not be formatted, only images <2GB will be formatted by imgmake as it cannot handle FAT32)
- mounted the VHD using Windows 7 Disk Manager
- initialized disk, created 1 partition and formatted it FAT32
- copied almost 8GB of large files to the image and created md5sum of the files
- inside dosbox, the FAT32 volume will not be visible, but Windows can be booted off another disk and will see the FAT32 volume
- ran md5sum and checked that all files are OK
- ran scandisk and checked it was ok

Only images up to 8GB are supported (1023/255/63). More would require working IDE emulation (edit: it seems extended int13/42h would also work). So far, a larger image can be mounted but Windows will most probably return "Error reading sector" as it tries to access data beyond the 1023 cyl. Creating 8GB image takes some time, be patient.

At first, I created the VHD with Win7 Disk Manager. For the 7GB image, it used only 16 heads and some 14000+ cylinders. Such image cannot be used as it exceeds 1023 cyl limit.

What is little known is that any "raw" image (such as the ones dosbox uses) can be converted to VHD with just writing the 512b footer. I use raw2vhd program for that and the functionality is now incorporated into imgmake. Why VHD? Because it can be natively mounted by Win7 & 8...Linux users? Tough luck :) (altough it still a valid raw image with the 512b footer at the end, kpartx will handle it just fine :happyhappy:)
You do not have the required permissions to view the files attached to this post.
Last edited by gulikoza on 2013-4-21 @ 10:35, edited 1 time in total.
User avatar
gulikoza
Oldbie
 
Posts: 1698
Joined: 2004-6-25 @ 14:53

Re: A patch for mounting hard drive image larger than 2GB

Postby ykhwong » 2013-3-16 @ 12:23

Thanks for the update. :) I like the support for fixed vhd images.
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: A patch for mounting hard drive image larger than 2GB

Postby IIGS_User » 2013-3-17 @ 05:07

ykhwong wrote: I like the support for fixed vhd images.

Me, too.
Klimawandel.
User avatar
IIGS_User
Oldbie
 
Posts: 882
Joined: 2007-3-14 @ 19:59
Location: native_lang=ger

Re: A patch for mounting hard drive image larger than 2GB

Postby gulikoza » 2013-4-19 @ 15:17

Here's a nice test...added INT13 extensions, so images >8GB (and >1023cyl) are supported. I was able to create a 12GB VHD image in Win7 fill it up and all md5sums passed inside dosbox.

Now the funny thing is, that images <8GB created with W7 disk manager still do not work. INT13 extension functions are not used even if available. I suspect this is because W7 will create a FAT32 partition type 0xB when image is <8GB. When over 8GB, 0xC partition type is created and INT13 extensions are used. Why W7 would create an image with more than 1023 cylinders and not set LBA partition type, I don't know, but maybe this would work if IDE would be supported.
Last edited by gulikoza on 2013-4-21 @ 10:34, edited 1 time in total.
User avatar
gulikoza
Oldbie
 
Posts: 1698
Joined: 2004-6-25 @ 14:53

Re: A patch for mounting hard drive image larger than 2GB

Postby gulikoza » 2013-4-21 @ 10:33

I wasn't really planning on working on this much more, but I found a pretty serious bug in the original hal's imgmake command. It creates partitions larger than disk (partition end cylinder is the same as disk geometry, but should be c-1 as cylinder count is zero based the same as heads) and that certainly can't be good :happy:

Aside from that, I've fixed imgmake to take parameters in any order (after creating an image named '-t' during my tests :happy:). I've added support for mounting empty (no mbr, unformatted) VHD images so they can be partitioned later in the booted system, and added geometry translation for <8GB && >1023cyl VHD images (fixes the problem mentioned in the above post).

BUT, here's a WARNING: Windows 7 Disk Manager no longer aligns partitions to cylinder boundary. While this may seem fine at first (the 7GB image created this way passed all md5sum checks) doing something like 'sys a: c:' will corrupt the filesystem! DOS & W9x officially need all partitions aligned to cylinder boundary (except the first and every logical which should be track +1). I assume images over 8GB (0xC partition type) are fine since they're using LBA and not CHS addressing. Therefore I'd suggest using internal imgmake for images <8GB (or partitioning the image with a program that creates compatible partition table).
You do not have the required permissions to view the files attached to this post.
User avatar
gulikoza
Oldbie
 
Posts: 1698
Joined: 2004-6-25 @ 14:53

Re: A patch for mounting hard drive image larger than 2GB

Postby Dominus » 2013-5-09 @ 19:56

Moving this to the patches forum viewforum.php?f=41
User avatar
Dominus
DOSBox Moderator
 
Posts: 7378
Joined: 2002-10-03 @ 09:54
Location: Vienna

Re: A patch for mounting hard drive image larger than 2GB

Postby DosWin » 2013-9-12 @ 15:33

I try to create 8gb hard drive image with Windows 98, but without success.
Steps, which I try:
1. Run DB . type - imgmake 8gb.vhd -t hd_8gig
2. Go to Win7 Disk Manager, select 8gb.vhd, init it.
3. Create simple partition, stay max size(max - 8022 MB, min - 8 MB, partition size - 8022MB), dont select word for 8gb.vhd.
4. Format setings: FAT32, 512, no fast format. Got a message - "cluster size is too small for selected filesystem".
5. Disconect 8gb.vhd from Win7 Disk Manager, run raw2vhd.exe. Got message - "default geometry C=1023 H=255 S=63 totalsize=8414461952 bytes complete"
6. Run dosbox with net commands in [autoexec]:
imgmount a "Boot.ima"
imgmount c "8gb.vhd" -t hdd -fs fat -ide 1m
imgmount d "win98se.iso" -fs iso -ide 2m
boot -l a
7. Got for 8gb.vhd - "The image must be on a host or local drive"(but in status window - "Mounted FAT volume is FAT12 with 2847 clusters"). Floppy(622C.img renamed to Boot.img) and CD(WIN98SE CD) mounts normally.
8. Go to D, cd Win98, setup. Got - "Cannot create temporaly folder. If NTFS, create MS-DOS boot sector".
9. View 8gb.vhd in WinImage, see - 0KB, 0 bytes free.

What I am doing wrong? With 2gb and 4gb mounts normally, but I also dont understand how to start Windows 98 installation. 8gb have few more problems.

I think, need more detailed guide\intruction for it, because, I think, its only obstacle to create 8gb hard drive image wth Windows 98.
DosWin
Newbie
 
Posts: 13
Joined: 2011-10-23 @ 12:57

Re: A patch for mounting hard drive image larger than 2GB

Postby gulikoza » 2013-9-14 @ 08:07

If you create the vhd with patched dosbox, you don't need to run raw2vhd again as the footer is already written by dosbox (and running it again will create another).

Please re-read this thread...I advised against initing and creating partitions with Win7 Disk Manager as the partition will not be properly aligned for DOS & Win9x. Boot the bootdisk then partition and format the image from DOS.
User avatar
gulikoza
Oldbie
 
Posts: 1698
Joined: 2004-6-25 @ 14:53

Re: A patch for mounting hard drive image larger than 2GB

Postby olddosuser » 2016-7-07 @ 22:06

I just found this post about mounting images lager than 2 GB. I currently have Win98 installed on a 2 GB .img file created with imgmake (Hal's Megabuild). I would like to use the patch to create larger images. What files do I need to download and how to I apply them? Also, what are the steps to create and mount the image? I am running Windows 10 and I also ImDisk installed. I used imdisk to put the Win98 setup folder inside the image to install windows. What is the image size limit?
olddosuser
Newbie
 
Posts: 21
Joined: 2010-3-27 @ 05:26

Re: A patch for mounting hard drive image larger than 2GB

Postby olddosuser » 2016-7-07 @ 22:10

Btw, I was referring to gulikoza's patch
olddosuser
Newbie
 
Posts: 21
Joined: 2010-3-27 @ 05:26

Re: A patch for mounting hard drive image larger than 2GB

Postby collector » 2016-7-08 @ 00:30

They are patches for the source which then has to be compiled. And note that Win9x is not supported in DOSBox. Spare yourself the pain and just use a VM instead of DOSBox.
User avatar
collector
l33t
 
Posts: 4035
Joined: 2003-1-15 @ 10:39


Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 1 guest