The dosemu HOWTO: Hard disk setup

Next Previous Contents

## 3. Hard disk setup

## 3.1 How do I use my hard disk with dosemu?

First, mount your dos hard disk partition as a Linux subdirectory. For example, you could create a directory in Linux such as /dos (mkdir -m 755 /dos) and add a line like

       /dev/hda1       /dos     msdos   umask=022

to your /etc/fstab. (In this example, the partition is mounted read-only. You may want to mount it read/write by replacing "022" with "000" and using the -m 777 option with mkdir). Now mount /dos. The README.txt says:

      you just can have a Linux directory containing all what you
      want to have under your DOS C:. Copy your IO.SYS, MSDOS.SYS or what
      ever to that directory (e.g. /var/lib/dosemu/bootdir), put

              $_hdimage = "bootdir"

      into your /etc/dosemu.conf, and up it goes. DOSEMU makes a lredir'ed
      drive out of it and can boot from it. You can edit the config.sys and
      the autoexec.bat within this directory before you start dosemu.  Fur-
      ther more, you may have a more sohisticated setup. Given you want to
      run the same DOS drive as you normal have when booting into native
      DOS, then you just mount you DOS partition under Linux (say to /dos)
      and put links to its subdirectories into the boot dir. This way you
      can decide which files/directories have to be visible under DOSEMU and
      which have to be different. Here's a small and incomplete example
      bootdir setup:

             config.sys
             autoexec.bat
             command.com -> /dos/command.com
             io.sys -> /dos/io.sys
             msdos.sys -> /dos/msdos.sys
             dos -> /dos/dos
             bc -> /dos/bc
             windows -> /dos/windows

      There is, however, one drawback, you can't use the DosC kernel
      (FreeDos) for it, because it hasn't yet a working redirector (will
      hopefully be available some time in the future).

## 3.2 How can I access the hdimage from Linux?

Use mtools. With a line in /etc/mtools.conf like

       drive n:  file="/var/lib/dosemu/hdimage" MTOOLS_SKIP_CHECK=1 \
       MTOOLS_LOWER_CASE=1 MTOOLS_NO_VFAT=1 partition=1 offset=128

you can use the mtools on the hdimage, like "mdir n:". "mcopy n:/config.emu /tmp" copies the config.emu file from the hdimage to /tmp/config.emu. You can edit it there and copy it back. Use a drive letter you find sensible. "N:" is only an example.

## 3.3 Can I use my stacked/double-spaced/super-stored disk?

At this time, compressed drives cannot be accessed via the redirector (lredir or emufs) on a standard kernel. There is a patch for the kernel to mount compressed files under the name "dmsdosfs". Find it on sunsite.unc.edu and its mirrors

> `http://sunsite.unc.edu:/pub/Linux/system/filesystems/dosfs/`

A good idea is also to look in http://sunsite.unc.edu:/pub/Linux/Incoming for a newer version. The "wholedisk" option in older versions of dosemu is no longer allowed in recent versions, however, a line like

       $_hdimage = "/dev/hda1"

may work, at the risk that you could lose all data in that partition on a dosemu crash.

If your dos partition is already mounted with write access and you try to run dosemu with partition access, dosemu will print a warning message and abort. This prevents DOS and Linux from making independent writes to your disk and trashing the data on your dos partition(95/8/11).

---------------------

If LILO is installed, the above will not work. However...

Thomas Mockridge (thomas@aztec.co.za) reported (94/8/5) that

To boot dosemu with LILO and Stacker 4.0 I did a little work around...

1. dd the MBR to a file. (or norton utility, etc., first 512 bytes)

2. Boot dos (from full boot not emu), do a fdisk /mbr, make your dos partition active with (dos) fdisk.

3. Copy the new MBR to a file.

4. Replace the original MBR

5. Copy the second MBR to /var/lib/dosemu/partition.hda? (Whichever is your dos partition)

6. Set dosemu.conf

                   disk {partition "/dev/hda? ?"}

7. Start dosemu and and voila! No LILO.

For recent versions of dosemu you need to change the

                   disk {partition "/dev/hda? ?"}

line to something like

                   $_hdimage = "/dev/hda1"

---------------------

Holger Schemel (q99492@pbhrzx.uni-paderborn.de) reported (94/2/10) that

Works even fine under dosemu with MS-DOS 6.0. If you have problems, then you have to edit the file 'DBLSPACE.INI' manually and change the disk letter to the letter your drive gets under dosemu.

---------------------

Darren J Moffat (moffatd@dcs.gla.ac.uk) also reported (94/3/27)

"...use 6.2 if you can get it!! Just make sure you have a LILO boot disk on hand since dos 6{.2} will change the MBR of the boot HZ."

## 3.4 Creating your own hdimage file.

The easy way is to use mkdexe - see README.txt for details. The old-fashioned way (I don't know why anyone would want to do it that way any more but here it is, just in case) is as follows:

There is an extra util program called mkfatimage16 which allows for creating a hdimage file headers. The full information is in the manpage (man/mkfatimage16.1) included in your distribution.

To create a hard disk image file with a geometry corresponding to that of a real hard disk of 32 megabytes run:

    mkfatimage16 -k 32768 > hdimage

This is probably too large for most needs; if you need this much space, consider using the disk redirector."

Usually it is a good idea to format the drive after it.

Next Previous Contents