Using Lredir
This section of the document by Hans,
<lermen@fgan.de>. Last
updated on October, 23 2002.
What is it? Well, its simply a small DOS program that tells the
MFS (Mach File System) code what 'network' drives to redirect.
With this you can 'mount' any Linux directory as a virtual drive
into DOS. In addition to this, Linux as well as multiple dosemu sessions
may simultaneously access the same drives, what you can't when using
partition access.
how do you use it?
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 hard disk 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. Now
you can add a line like
lredir d: linux\fs/dos
to the AUTOEXEC.BAT file in your hdimage (but see the comments
below). On a multi-user system you may want to use
lredir d: linux\fs\${home}
where "home" is the name of an environmental variable that contains
the location of the dos directory (/dos in this example)
You may even redirect to a NFS mounted volume on a remote machine with
a /etc/fstab entry like this
otherhost: /dos nfs nolock
Note that the nolock> option might be
needed for 2.2.x kernels, because
apparently the locks do not propagate fast enough and DOSEMU's (MFS code)
share emulation will fail (seeing a lock on its own files).
In addition, you may want to have your native DOS partion as C: under dosemu.
To reach this aim you also can use Lredir to turn off the 'virtual'
hdimage and switch on the real drive C: such as this:
Assuming you have a c:\dosemu directory on both drives (the virtual
and the real one) and have mounted your DOS partition as /dosc,
you then should have the following files on the virtual drive:
autoexec.bat:
lredir z: linux\fs\dosc
copy c:\dosemu\auto2.bat z:\dosemu\auto2.bat
lredir del z:
c:\dosemu\auto2.bat
dosemu\auto2.bat:
lredir c: linux\fs\dosc
rem further autoexec stuff
To make the reason clear why the batch file (not necessaryly autoexec.bat)
must be identical:
Command.com, which interpretes the batchfile keeps a position pointer
(byte offset) to find the next line within this file. It opens/closes the
batchfile for every new batchline it reads from it.
If the batchfile in which the 'lredir c: ...' happens is on c:, then
command.com suddenly reads the next line from the batchfile of that
newly 'redired' drive. ... you see what is meant?
Other alternatives using Lredir
To have a redirected drive available at time of config.sys you may
either use emufs.sys such as
device=c:\emufs.sys /dosc
or make use of the install instruction of config.sys (but not both) such as
install=c:\lredir.exe c: linux\fs\dosc
The later has the advantage, that you are on your native C: from the
beginning, but, as with autoexec.bat, both config.sys must be identical.
For information on using 'lredired' drives as a 'user' (ie having the right
permissions), please look at the section on Running dosemu as a normal user.