PartUtil
2025-07-07 Version
Michael Brutman (mbbrutman@gmail.com)

Home page: http://www.brutman.com/PartUtil/PartUtil.html


PartUtil is a limited partition editor that makes it easier to dual-boot
multiple verions of DOS without having a boot manager installed.
Below is a text version of the documentation at the home page.


Overview

  If you want to have more than one operating system installed on your
  hard drive you can partition it and install an operating system in
  each partition. FDISK supports this by letting you create partitions
  and set one of them to be active.

  When running DOS this can cause drive letter mappings to change. Later
  versions of DOS usually will be able to see and map drive letters to
  the earlier versions of DOS, while earlier versions of DOS will ignore
  the newer filesystems that they don't understand. If you have additional
  drive letters in an extended partition those are also affected. Imagine
  having a drive letter for common utilities that keeps moving around each
  time you switch DOS versions ... that is annoying.

  The general solution to this is to install a boot manager that can hide
  or unhide partitions as needed. Hiding a partition means changing the
  partition type in the MBR to something that the active operating system
  does not recognize, and thus no drive letter is assigned to it. Boot
  managers are a good solution for later systems but I really don't want
  to install one on a PCjr. I want something that I know runs under any
  version of DOS, runs on any class of PC, and only touches the MBR.
  (No special installation procedure or hidden data on the drive should
  be needed.)

  My solution to this was to write a simple partition switcher - you told
  it what primary partition you wanted to activate, and it would unhide
  that partition, set it active, and hide the other primary partitions.
  That worked for years and I managed to lose the source code, so when I
  wanted to add features to it I had to start from scratch. And here
  we are ...


Usage

  PartUtil is a stand-alone program that you just run - no installation
  is needed. It runs under all versions of DOS and is less than 20KB
  in size.

  No changes will ever be made to your hard drive without giving you a
  chance to confirm the changes.

  At startup it will read the drive geometry from the BIOS and read the
  Master Boot Record (MBR) from sector zero of the first hard drive.
  It will then show you the partition table of the hard drive.


The current and pending partition table display:

 * The drive geometry will be in Cylinder/Head/Sector (CHS) format.
   That may not be the actual drive geometry, as the BIOS may be doing
   some form of translation. For this tool that does not matter.
 * If a partition is active it will have an asterisk in the "Active" column.
   Only one partition should ever be marked active; more than one active
   partition is an error. It is possible to not have any active partitions
   but that means nothing on this hard drive should be bootable.
 * The "Size" column is in megabytes (MB) and it should always be accurate
   to within one tenth of a megabyte. The "Start CHS" and "End CHS" columns
   may not be accurate due to the limits of CHS addressing, especially on
   larger drives. This tool doesn't alter or use the CHS fields and they
   are only there for informational purposes. (DOS FDISK always works in
   cylinders.)
 * PartUtil always shows the existing MBR as it appears on disk first.
   If you have made changes then it will show the pending changes next.


Basic commands:

 * setActive and clearActive: Mark or unmark a partition as active.
 * hide or unhide: Hide or unhide a partition.
 * show: Show the current MBR and any pending changes.
 * revert: Undo any pending changes to the MBR.
 * write: Write pending changes to the MBR. (You will be asked to confirm
   the changes.)
 * reboot: Reboot the machine.
 * quit: Quit the program. (Ctrl-C also works.) Pending changes will
   not be saved.

  Hide and unhide only work on a limited set of partition types. If you
  need to hide or unhide a partition type that PartUtil refuses to touch
  use the setType command described later.


Save and restore commands:

 * saveCurrentMBR: Save the current MBR on the disk to a file.
 * loadPendingMBR: Load pending changes from a file on the disk.
 * savePendingMBR: Save pending changes to a file on the disk.

  Saving the current MBR to a file allows you to recover from accidents
  when using this tool, FDISK, or other partition editors. You should
  specify a file on a floppy disk for safety; after an accident your hard
  drive might not be readable until the partition table is correctly
  restored.

  SavePendingMBR and loadPendingMBR let you save or load proposed MBRs
  to/from files. This is useful when you are crafting your dual boot setup;
  instead of hiding, unhiding and setting a partition active each time you
  can save the proposed changes in a file and load them when needed.


Expert mode commands:

 * setType: Force a partition to be a specific partition type. Useful
   for hiding or unhiding a partition when PartUtil doesn't understand
   the partition type.
 * delete: Deletes a partiton from the partition table. FDISK will only
   delete DOS partitions, limiting its usefulness when setting up a new
   hard drive.
 * wipeMBR: Write zeros to the entire MBR. This is "the nuclear option"
   and should only be needed when installing a new hard drive.

  To get into expert mode start PartUtil using the "-expert" option on
  the command line.


How to dual (or triple!) boot

  To setup your drive, use FDISK or another partition editor to create the
  partitions for your operating systems. You might need to use wipeMBR or
  delete to get rid of partitions that FDISK won't touch. DOS FDISK also
  won't create a new DOS partition if it sees an existing one so you can
  use PartUtil to hide the other DOS partitions as you partition and install
  the various versions of DOS.

  Note that each version of DOS has rules for where and how it can be
  installed. For example, DOS 2.1 must be within the first 32MB of the
  drive. You might need to try a few experiments until you find a setup
  that works.


To switch partitions:

 * Unhide the partition you want to boot from.
 * Mark that partition as active.
 * Hide the other partitions that you don't want drive letters for.
 * Review the changes then write them to the hard drive.
 * Reboot!

  After testing and getting comfortable consider automating the process.
  With the savePendingMBR command you can write the pending changes to a
  file. Then later you can use loadPendingMBR, write the changes to disk
  and reboot without having to use the hide, unhide and setactive commands.
  PartUtil will read from the keyboard or a redirected file so you can put
  the commands in a file and replay them.


Disclaimer

  Editing the MBR of a hard drive can lead to data loss. Doing it by hand
  is not advised, which is why we have tools. But even with a well written
  tool things can go wrong.

  This tool minimizes risk by only manipulating the active flag on a
  partition and only marking specific partition types and hidden or
  visible. The other parts of the partition table and MBR are not touched.

  As always, ensure you have a back up of your data and the MBR before
  using this or any similar tool that can cause data loss. I've tested it
  fairly well and I use it on my personal systems, but I take no liability
  for the code or user errors.


Licensing

  This code is available as open source software under the
  terms of the GNU General Public License version 2.  Please see
  COPYING.TXT which includes the terms of the license.

  In short, share and enjoy while respecting the license.  Although
  it is open source software I still maintain the copyright to all of
  my contributions.

  This code is free to use.  There is no warranty of any kind.  While I
  take pride in my work, this is a hobby project so if it burns down your
  house, causes an Martian invasion, or gives you indigestion I will
  feel badly but I am not legally responsible.


Comments or questions?  Email me at mbbrutman@gmail.com.


Lastly, enjoy!
-Mike
