Using Linux and DOS Together
When machines come from a factory with DOS pre-installed on them, the hard disks are normally arranged so the whole disk is the C: drive. This is very inflexible, even if you only want to run DOS, and unbearable if you also want to run other operating systems. PC partition tables support the following configurations (with a total of 4 allowed):
One primary DOS partition
One extended partition (containing a number of logical partitions)
One or more non-DOS partitions (good for Linux)
In order to run Linux, you typically have to repartition your disk, which is often a good idea whatever operating system you run for the following reasons on (DOS or UNIX):
Crash resistance Typically, disk problems are reserved to one logical disk on the media. By having more than one logical disk on a physical device, if anything goes haywire, it is reserved to one partition.
Control You may not want to allocate your whole hard disk to any application. Giving sets of applications a partition limits the amount of disk space they can use. You may get “out of disk space” on partitions, but not necessarily for the whole disk.
When you want to repartition your disk, standard procedure used to be:
Back up to floppies
Erase your hard disk
Recover your floppies
This may have worked with a few meg to back up, but now PCs normally come with 200 Mb installed in a Microsoft Windows system, with little documentation about what's important and what's not. There is a very clever utility called fips, written by Arno Schaefer, email@example.com. It is kept on sunsite.unc.edu in /pub/Linux/system/Install/fips12.zip.
fips non-destructively shrinks your primary partition, leaving all your files in place. You run defrag (an MS-DOS program) to pack all the files into contiguous sectors and then fips to shrink your primary partition.
You can then reboot and create an extended DOS partition (with the DOS fdisk program), and use Linux to create Linux partitions (with the Linux fdisk program). fips is a wonderful tool that solves a very real problem. Please read the instructions carefully before using it; any tool which writes your partition table, like fdisk, should be used with caution.
N.B.: Be very careful using fdisk. Don't do anything destructive to your media (i.e mkfs or format from DOS) until you are sure DOS and Linux agree on where the partitions are. I've noticed very “unnice” features with the DOS fdisk program—it read the free space as 100 Mb (which was correct), but when I allowed it to make a partition with all the free space, it made a 350 Mb partition (very naughty!)
Extended partitions are a way around the 4 partition limit on a physical disk. An extended partition can serve as a container for more partitions, which can be DOS, Linux (native or swap) or any other type. Remember, non-DOS partitions need to be made in a non-DOS version of fdisk. Extended partitions are handy for generating more than the 4 partitions normally found. I have never seen a good discussion of adding swap space to a system—a good way is using extended partitions.
Extended partitions are a good idea—for running DOS. Each logical partition in the extended partition is given a letter by DOS (i.e. D:, E: , F:). Each of these drives can then be formatted and used under DOS. I use an application called join, which as of DOS 6 is no longer distributed with DOS, but you can still get a copy via ftp from ftp.microsoft.com in /peropsys/msdos/public/supplmnt/. join essentially allows you to “mount drives” so you have a single hierarchical tree (like Linux).
For instance, I might configure a system with drive D: for personal stuff and E: for djgpp, a port of the GNU C compiler to DOS. Then, in my root directory on my C drive I create directories for \marty, \gnu, and in my autoexec.bat, I have:
join d: \marty join e: \gnu
so that I don't have to deal with drive letters. I also join A: to \a, so my floppy disks appears on the tree. But if you do something like this you'll break the DOS format program and almost every DOS install/setup program for commercial software. It seems that they can't deal with anything except A:.
Unfortunately, you can't use join with network drives. More on this later when we talk about DOSEMU.
- Bruce Nikkel's Practical Forensic Imaging (No Starch Press)
- Transitioning to Python 3
- Progress on Privacy
- Linux Journal December 2016
- Stepping into Science
- Radio Free Linux
- CORSAIR's Carbide Air 740
- The Tiny Internet Project, Part II
- FutureVault Inc.'s FutureVault
- A Better Raspberry Pi Streaming Solution