Difference between revisions of "IMGMOUNT"

From DOSBoxWiki
Jump to navigationJump to search
(CD-ROM=>optical disc. Also copied over (and improved) guides from the old wiki)
Line 1: Line 1:
(excerpt from official DOSBox Readme)
+
A utility to mount hard disk and optical disc images in DOSBox.
  
=IMGMOUNT=
+
'''Note:''' You can use [http://hp.vector.co.jp/authors/VA013937/editdisk/index_e.html Disk Explorer] to copy files and folders to/from images. But do '''not''' attempt to use it to delete files and folders from images as it ruins the image as far as DOSBox is concerned (just settle on deleting files and folders from image using DOSBox itself).
A utility to mount disk images and CD-ROM images in DOSBox.
+
 
 +
==Command line parameters==
  
 
<code>IMGMOUNT DRIVE [imagefile] -t [image_type] -fs [image_format]<br/>
 
<code>IMGMOUNT DRIVE [imagefile] -t [image_type] -fs [image_format]<br/>
-size [sectorsbytesize, sectorsperhead, heads, cylinders]</code>
+
[[#The "-size" parameter (required to to create bootable hard disk images)|-size]] [sectorsbytesize, sectorsperhead, heads, cylinders -u DRIVE]</code>
  
;imagefile: 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. <code>"~/images/CD1.cue ~/images/CD2.cue [...] ~images/CDn.cue"</code>) CD-ROM 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.
+
;DRIVE: Drive name (letter) the image will use
 +
*a for the drive letter a:\ or
 +
*b for the drive letter b:\ etc...
 +
 
 +
;imagefile: 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. <code>"~/images/CD1.cue ~/images/CD2.cue [...] ~images/CDn.cue"</code>) 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.
 
    
 
    
 
;-t: The following are valid image types:
 
;-t: The following are valid image types:
 
:;floppy: Specifies a floppy image or images. DOSBox will automatically identify the disk geometry (360K, 1.2MB, 720K, 1.44MB, etc).
 
:;floppy: Specifies a floppy image or images. DOSBox will automatically identify the disk geometry (360K, 1.2MB, 720K, 1.44MB, etc).
:;iso: Specifies a CD-ROM iso image.  The geometry is automatic and set for this size. This can be an iso or a cue/bin.
+
:;iso: Specifies an optical disc iso image.  The geometry is automatic and set for this size. This can be an iso or a cue/bin.
:;hdd: Specifies a harddrive image. The proper CHS geometry must be set for this to work.
+
:;hdd: Specifies a hard disk image. The proper CHS geometry must be set for this to work.
  
 
;-fs: The following are valid file system formats:
 
;-fs: The following are valid file system formats:
:;iso: Specifies the ISO 9660 CD-ROM format.
+
:;iso: Specifies the ISO 9660 optical disc format.
 
:;fat: 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.
 
:;fat: 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.
 
:;none: 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: <code>"imgmount 3 d:\test.img -size 512,63,16,142 -fs none"</code> (without the quotes). Compare this with a mount to read the drive in DOSBox, which would read as: <code>"imgmount e: d:\test.img -size 512,63,16,142"</code>.
 
:;none: 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: <code>"imgmount 3 d:\test.img -size 512,63,16,142 -fs none"</code> (without the quotes). Compare this with a mount to read the drive in DOSBox, which would read as: <code>"imgmount e: d:\test.img -size 512,63,16,142"</code>.
  
;-size: The Cylinders, Heads and Sectors specification of the drive. Required to mount hard drive images. An example how to mount CD-ROM images:
+
;[[#The "-size" parameter (required to to create bootable hard disk images)|-size]]: The Cylinders, Heads and Sectors specification of the drive. '''Only''' required to to create [[#Bootable hard disk images|bootable hard disk images]]. This means it is '''not''' required for either [[#Loading a regular hard disk image|loading a regular hard disk image]] or [[#optical disc images|optical disc images]].
:#<code>"mount c /tmp"</code>
+
 
:#<code>"imgmount d c:\myiso.iso -t iso"</code> or (which also works):
+
;-u: unmount an image.
:#<code>"imgmount d /tmp/myiso.iso -t iso"</code>
+
*e.g. if an disk image was mounted to be the disk drive a:\ type:
 +
*<code>"imgmount -u a"</code>
 +
 
 +
==Optical disc images==
 +
===Loading an ISO image===
 +
====An example in Windows====
 +
<pre>
 +
Z:>mount c "c:\images"
 +
Z:>imgmount d "C:\MyISO.iso" -t iso
 +
Z:>d:
 +
D:>
 +
</pre>
 +
 
 +
====An example in Unix====
 +
<pre>
 +
Z:>mount c "/tmp"
 +
Z:>imgmount d "/tmp/MyISO.iso" -t iso
 +
Z:>d:
 +
D:>
 +
</pre>
 +
 
 +
===Loading an CUE image===
 +
====An example in Windows====
 +
<pre>
 +
Z:>mount c "c:\images"
 +
Z:>imgmount d "C:\cdimg.cue" -t iso -fs iso
 +
Z:>d:
 +
D:>
 +
</pre>
 +
 
 +
====An example in Unix====
 +
<pre>
 +
Z:>mount c "/tmp"
 +
Z:>imgmount d "/tmp/cdimg.cue" -t iso -fs iso
 +
Z:>d:
 +
D:>
 +
</pre>
 +
 
 +
Note: 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|bootable hard disk images]])===
 +
Didn't understand the "512,63,16,142" part?
 +
 
 +
All you really need to know is that the forumula is always:
 +
<pre>-size 512,63,16,X</pre>
 +
'''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:
 +
 
 +
<pre>
 +
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
 +
[10] 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.
 +
</pre>
 +
 
 +
You don't actually need to know the total numbers of sectors, other than to calculate the sector size (in bytes):
 +
 
 +
<pre>
 +
bytes-per-sectors = total-file-size-in-bytes / total-sectors
 +
bytes_per_sectors = 73285632 / 143136
 +
bytes_per_sectors = 512
 +
</pre>
 +
Now you have all you need.
 +
 
 +
Start the line with 512 and then add the 3 first parts in reverse order. In other words:
 +
 
 +
<code>imgmount ...... -size 512,63,16,142</code>
 +
* 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:
 +
 
 +
<code>imgmount ...... -size 512,63,16,'''X'''</code>
 +
* 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===
 +
====Example====
 +
<pre>
 +
Z:>mount d c:\images
 +
Z:>d:
 +
D:>imgmount c "70mb.img"
 +
</pre>
 +
 
 +
===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 <code>msdos622.img</code>.
 +
 
 +
Now you need to complete these tasks:
 +
 
 +
# [[#Create a partition with "fdisk"|Create a partition with "fdisk"]]
 +
# [[#Format the partition with "format"|Format the partition with "format"]]
 +
 
 +
=====Create a partition with "fdisk"=====
 +
Start DOSBox and type:
 +
<pre>
 +
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)
 +
</pre>
 +
When DOSBox has booted from the MS-DOS 6.22 image from <code>msdos622.img</code>, you must use "fdisk" to partition the "fixed" disk being emulated by the 70 MB disk image:
 +
<pre>
 +
A:\>fdisk
 +
Just choose the first option in every menu ("Primary", etc) to create C:
 +
</pre>
 +
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:
 +
<pre>
 +
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
 +
</pre>
 +
Exit DOSBox.
 +
 
 +
The hard disk image is now bootable! See [[#Loading a bootable hard disk image|Loading a bootable hard disk image]].
  
(excerpt from official DOSBox Readme)
+
====Loading a bootable hard disk image====
 +
From now on, whenever you want to boot from drive C:, start DOSBox and type, for example:
 +
<pre>
 +
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:>
 +
</pre>

Revision as of 12:49, 10 March 2008

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 do not attempt to use it to delete files and folders from images as it ruins the image as far as DOSBox is concerned (just settle on deleting files and folders from image using DOSBox itself).

Command line parameters

IMGMOUNT DRIVE [imagefile] -t [image_type] -fs [image_format]
-size [sectorsbytesize, sectorsperhead, heads, cylinders -u DRIVE]

DRIVE
Drive name (letter) the image will use
  • a for the drive letter a:\ or
  • b for the drive letter b:\ etc...
imagefile
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.
-t
The following are valid image types:
floppy
Specifies a floppy image or images. DOSBox will automatically identify the disk geometry (360K, 1.2MB, 720K, 1.44MB, etc).
iso
Specifies an optical disc iso image. The geometry is automatic and set for this size. This can be an iso or a cue/bin.
hdd
Specifies a hard disk image. The proper CHS geometry must be set for this to work.
-fs
The following are valid file system formats:
iso
Specifies the ISO 9660 optical disc format.
fat
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.
none
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".
-size
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.
-u
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 an 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: 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 forumula is always:

-size 512,63,16,X

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
[10] 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

Example

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 msdos622.img.

Now you need to complete these tasks:

  1. Create a partition with "fdisk"
  2. Format the partition with "format"
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

Exit DOSBox.

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:>