A utility to mount hard disk and optical disc images in DOSBox.
Note: You can use Disk Explorer to copy files and folders to/from images (but not to delete them or DOSBox will consider the images corrupted! Read the aforementioned link above for more info).
- 1 Command line parameters
- 2 Optical disc images
- 3 Hard disk images
- 3.1 The "-size" parameter (required to to create bootable hard disk images)
- 3.2 Loading a regular hard disk image
- 3.3 Bootable hard disk images
Command line parameters
IMGMOUNT DRIVE [imagefile] -t [image_type] -fs [image_format]
-size [sectorsbytesize, sectorsperhead, heads, cylinders -u DRIVE]
- Drive name (letter) the image will use
- a for the drive letter a:\ or
- b for the drive letter b:\ etc...
- Location of the image files to mount in DOSBox. The location can be on a mounted drive inside DOSBox, or on your real disk. It is possible to mount multiple (e.g.
"~/images/CD1.cue ~/images/CD2.cue [...] ~images/CDn.cue") optical disc images (ISOs or CUE/BIN) as well, if you need CD swapping capabilities specify all images in succession. The CDs can be swapped with CTRL-F4 at any time.
- The following are valid image types:
- Specifies a floppy image or images. DOSBox will automatically identify the disk geometry (360K, 1.2MB, 720K, 1.44MB, etc).
- Specifies an optical disc iso image. The geometry is automatic and set for this size. This can be an iso or a cue/bin.
- Specifies a hard disk image. The proper CHS geometry must be set for this to work.
- The following are valid file system formats:
- Specifies the ISO 9660 optical disc format.
- Specifies that the image uses the FAT file system. DOSBox will attempt to mount this image as a drive in DOSBox and make the files available from inside DOSBox.
- DOSBox will make no attempt to read the file system on the disk. This is useful if you need to format it or if you want to boot the disk using the BOOT command. When using the "none" filesystem, you must specify the drive number (2 or 3, where 2=master, 3=slave) rather than a drive letter. For example, to mount a 70MB image as the slave drive device, you would type:
"imgmount 3 d:\test.img -size 512,63,16,142 -fs none"(without the quotes). Compare this with a mount to read the drive in DOSBox, which would read as:
"imgmount e: d:\test.img -size 512,63,16,142".
- The Cylinders, Heads and Sectors specification of the drive. Only required to to create bootable hard disk images. This means it is not required for either loading a regular hard disk image or optical disc images.
- unmount an image.
- e.g. if an disk image was mounted to be the disk drive a:\ type:
"imgmount -u a"
Optical disc images
Loading an ISO image
An example in Windows
Z:>mount c "c:\images" Z:>imgmount d "C:\MyISO.iso" -t iso Z:>d: D:>
An example in Unix
Z:>mount c "/tmp" Z:>imgmount d "/tmp/MyISO.iso" -t iso Z:>d: D:>
Loading a CUE image
An example in Windows
Z:>mount c "c:\images" Z:>imgmount d "C:\cdimg.cue" -t iso -fs iso Z:>d: D:>
An example in Unix
Z:>mount c "/tmp" Z:>imgmount d "/tmp/cdimg.cue" -t iso -fs iso Z:>d: D:>
Note: make sure to use CUE and not BIN for audio CDs
You can mount bin/cue type CD images with the imgmount command, and it will 'sort of' work if you specify the .bin file as the file to mount. However, it may not mount the audio tracks of the CD correctly if you do this. Specifying the associated .cue file instead seems to cause the audio tracks to be mounted correctly.
Hard disk images
The "-size" parameter (required to to create bootable hard disk images)
Didn't understand the "512,63,16,142" part?
All you really need to know is that the formula is always:
X is the number of "cylinders" in the image. It's based on the image's size. If you create the image through Bochs, then it would tell you the number of cylinders.
If you want to understand a little more, here's a more detailed explanation than the official one on the numbers.
Now, let's say you created a 70M image using the bximage program from Bochs. You will then get the following details:
I:> bximage.exe ======================================================================== bximage Disk Image Creation Tool for Bochs $Id: bximage.c,v 1.32 2006/06/16 07:29:33 vruppert Exp $ ======================================================================== Do you want to create a floppy disk image or a hard disk image? Please type hd or fd. [hd] What kind of image should I create? Please type flat, sparse or growing. [flat] Enter the hard disk size in megabytes, between 1 and 129023  70 I will create a 'flat' hard disk image with cyl=142 heads=16 sectors per track=63 total sectors=143136 total size=69.89 megabytes What should I name the image? [c.img] 70mb.img Writing:  Done. I wrote 73285632 bytes to 70mb.img.
You don't actually need to know the total numbers of sectors, other than to calculate the sector size (in bytes):
bytes-per-sectors = total-file-size-in-bytes / total-sectors bytes_per_sectors = 73285632 / 143136 bytes_per_sectors = 512
Now you have all you need.
Start the line with 512 and then add the 3 first parts in reverse order. In other words:
imgmount ...... -size 512,63,16,142
- Here's a tip: the first 3 numbers should always be the same. So all you really need is the cyl=X. In other words, it should always be:
imgmount ...... -size 512,63,16,X
- Only the X changes, according to the size you specify when you create the image.
That wasn't so hard, was it? ;-)
Loading a regular hard disk image
Z:>mount d c:\images Z:>d: D:>imgmount c "70mb.img"
Bootable hard disk images
Creating a bootable hard disk image
Basically, you need to create an empty hard disk image and then format it with a bootable floppy image. So first find or make yourself a bootable floppy. In this example, let's say it's called
Now you need to complete these tasks:
Create a partition with "fdisk"
Start DOSBox and type:
Z:>mount d c:\images Z:>d: D:>imgmount 2 "70mb.img" -size 512,63,16,142 -t hdd -fs none D:>boot "msdos622.img" (Opening image file: msdos622.img)
When DOSBox has booted from the MS-DOS 6.22 image from
msdos622.img, you must use "fdisk" to partition the "fixed" disk being emulated by the 70 MB disk image:
A:\>fdisk Just choose the first option in every menu ("Primary", etc) to create C:
Don't panic if it ends up with an error message! When this is over, just exit DOSBox (or crash exit if needed).
The hard disk image is now ready for action.
Format the partition with "format"
Start DOSBox again and type:
Z:>mount d c:\images Z:>d: D:>imgmount 2 "70mb.img" -size 512,63,16,142 -t hdd -fs none D:>boot "msdos622.img" (Opening and booting from image file: msdos622.img) ... A:\>format c: /s
The hard disk image is now bootable! See Loading a bootable hard disk image.
Loading a bootable hard disk image
From now on, whenever you want to boot from drive C:, start DOSBox and type, for example:
Z:>mount d c:\images Z:>d: D:>imgmount c "70mb.img" D:>boot -l c (Opening and directly booting from image file: 70mb.img) C:>