Drive Letter Manipulator

This software has been designed to list drive letter assignments to physical disk drives and hard disk partitions and to manipulate these assignments. Its main purpose is to restore drive letters when they get shifted after the installation of other hard disks, e.g. ones in hard disk racks. The drive letter changes, when made early enough upon the startup of DOS mode, are also visible in Windows 95/98/ME.

WARNING: It is important that all your DOS drives must have non-empty unique volume labels for this software to operate correctly!

NOTE: In this documentation, Windows means Windows 95/98/ME. In Windows NT/2000/XP, you can use the Disk Administrator, Disk Management or a similar utility of the Control Panel to assign drive letters anyway so this software is not needed.

CREDIT: Some ideas, data consistency checks and error messages in this software have been taken from the reverse engineering of DrvOrder (© by unknown, 2000).

1. Usage

Before using the software for the first time, see the next section for important notes!

The software comes in two flavors. You can use the executable version, with COM extension, of the software from the command line or AUTOEXEC.BAT:

DLMANIP [-|/<options>] <command> [<parameters>...]

Alternatively, you can use the driver version, with SYS extension, from CONFIG.SYS:

DEVICE=<path>\DLMANIP.SYS [-|/<options>] <command> [<parameters...>]

If parameters contain spaces, enclose them into quotation marks. In drive letters, you may append the colon, if you like.

If you install device drivers, from drives whose letter needs to be changed, in CONFIG.SYS then load the driver version of the software from CONFIG.SYS beforehands. Note that you have to specify the full name of the driver, including its path: at that point, the PATH environment variable is not defined yet so DOS cannot find the file automatically.

Note that the driver is not a real device driver: it does not install itself anywhere and it returns all the memory to DOS when it has finished processing the command specified.

Commands:

Options:

The original DOS algorithm starts the assignment of hard disk partitions with the drive letter C:, independently of the number of floppy disk drives installed. It processes only those partitions whose type it recognizes – for DOS 3.x and above versions: FAT12 and FAT16; for DOS 7.x versions in Windows 95 OSR2 and Windows 98: FAT32, as well – and skips partitions of all other types – including but not limited to HPFS/NTFS, Linux native, Linux swap etc. Its main steps are the following:

  1. Process the first primary partition of all hard disks.

    Start at first hard disk and see if it has a primary partition. If so, assign a drive letter to the first such primary partition (the one with the lowest partition number).

    Do the same with the next hard disk and continue until reaching the last hard disk.

  2. Process all logical partitions of all hard disks.

    Start at first hard disk and see if it has an extended partition. (There may be one only extended partition, if any, on each hard disk). If so, traverse through it and assign subsequent drive letters to each logical drive, in the order that they are defined in the extended partition.

    Do the same with the next hard disk and continue until reaching the last hard disk.

  3. Process further primary partitions of all hard disks.

    Start at first hard disk and see if it has more than one primary partition. If so, assign a drive letter to them, in the order of their definition in the Master Boot Record. Make sure to skip the first primary partition as a drive letter has already been assigned to it in step 1.

    Do the same with the next hard disk and continue until reaching the last hard disk.

Linux uses a significantly simpler algorithm. All partitions on all hard disks are processed, even if their type is not recognized. Its main steps are the following.

  1. The two floppy disk drives are named "fd0" (usually A: under DOS/Windows) and "fd1" (usually B:). If more floppy disk drives are installed, they get subsequent numbers after the "fd" prefix.

  2. IDE hard disks are named "hda", "hdb", "hdc" etc. Note that, unlike with DOS/Windows, these names do not change if other hard disks installed. The master hard disk on the primary IDE channel is always "hda"; the primary slave is always "hdb"; the secondary master is "hdc"; the secondary slave is "hdd" etc.

    SCSI hard disks are names "sda", "sdb", "sdc" etc., in a similar manner.

  3. Primary and extended partitions, those defined in the Master Boot Record, are numbered from 1 to 4, thus are named "XdY1" to "XdY4" where "XdY" is the name assigned to their parent hard disk in step 2. (Yes, extended partitions also have a name, although they cannot be used to store data.)

  4. If an extended partition exists, its logical drives are numbered from 5 upwards, in the order they were defined in the extended partition.

This software uses a similar algorithm for assigning names to partitions. The "LIST" command includes these partition names in its output:

  1. The first device that the BIOS recognizes as an IDE hard disk, SCSI hard disk or equivalent is named "hda"; the second is named "hdb" etc.

    This device may also be an IDE/SCSI CD-ROM or DVD-ROM or a USB/Firewire hard disk, CD-ROM, DVD-ROM, flash drive or pen drive etc., if your BIOS supports accessing such devices – and can, perhaps, even boot from them.

    For this reason, unlike under Linux, "hda" is not necessarily the master hard disk on the primary IDE channel. Also, holes between IDE devices are not taken into account by the BIOS: e.g if the primary master is present, the primary slave is missing, and the secondary master is present then the secondary master will be named "hdb", not "hdc" as Linux would name it. This is a limitation of the BIOS, not this software.

  2. Partitions are numbered the same way as under Linux (see above).

An example for drive letters shifting after the installation of another hard disk and the "REASSIGN" command taking care of it. You have two hard disks installed all the time, each have one primary partition and two logical drives. DOS assigns drive letters as the following:

C: First hard disk, primary partition
D: Second hard disk, primary partition
E: First hard disk, first logical drive
F: First hard disk, second logical drive
G: Second hard disk, first logical drive
H: Second hard disk, second logical drive

Now install a third hard disk, with one primary partition and two logical drives on it. The result is:

C: First hard disk, primary partition
D: Second hard disk, primary partition
E: Third hard disk, primary partition
F: First hard disk, first logical drive
G: First hard disk, second logical drive
H: Second hard disk, first logical drive
I: Second hard disk, second logical drive
J: Third hard disk, first logical drive
K: Third hard disk, second logical drive

As you can see, the logical drives of the two main hard disks had their letters shifted. Now use the "REASSIGN 2" command and you get:

C: First hard disk, primary partition
D: Second hard disk, primary partition
E: First hard disk, first logical drive
F: First hard disk, second logical drive
G: Second hard disk, first logical drive
H: Second hard disk, second logical drive
I: Third hard disk, primary partition
J: Third hard disk, first logical drive
K: Third hard disk, second logical drive

This is the original drive letter assignment plus letters from the end of the alphabet have been assigned to the partitions of the third hard disk. For a test, try the "REASSIGN 1" command, and you will get:

C: First hard disk, primary partition
D: First hard disk, first logical drive
E: First hard disk, second logical drive
F: Second hard disk, primary partition
G: Third hard disk, primary partition
H: Second hard disk, first logical drive
I: Second hard disk, second logical drive
J: Third hard disk, first logical drive
K: Third hard disk, second logical drive

Note that the letter D: is not assigned to the primary partition of the second hard disk anymore because you specified that you have only one main hard disk.

Drive letter manipulations also work under the DOS mode of Windows. If you launch Windows afterwards, the new drive letter assignments will be visible there, too.

Special note for Windows users! If your operating system is installed onto a partition whose drive letter has been changed, you may run into one or more of the following errors while Windows is being loaded:

If your Windows ran fine before then these problems are, most probably, all related to DOS and Windows getting confused about the drive letter of the system partition being different from what it expects.

A suggested solution for all of the problems above is the following. First, copy the driver version of this software into a directory on a drive whose letter is never going to change – obviously, the best candidate for this is a directory on drive C: -; "C:\WINBOOT" in the example. Also copy HIMEM.SYS and IFSHLP.SYS from the Windows directory into this directory. Then prepend the following lines to your CONFIG.SYS:

DEVICE=C:\WINBOOT\DLMANIP.SYS /Q <command> <parameters...>
DEVICE=C:\WINBOOT\HIMEM.SYS
DEVICE=C:\WINBOOT\IFSHLP.SYS
[...]

The first line fixes drive letters. The second and third lines explicitly install the otherwise invisibly and automatically installed system drivers.

Use the letter manipulation commands of this software to change the drive letters, before letting DOS process the rest of CONFIG.SYS. Remember, these must be the first lines of your CONFIG.SYS!

If there are some other drivers that you install from the Windows directory in CONFIG.SYS then make a copy of those, too, and change your CONFIG.SYS accordingly. For example, to install country and code page settings:

[...]
COUNTRY=<country>,<code page>,C:\WINBOOT\COUNTRY.SYS
DEVICE=C:\WINBOOT\DISPLAY.SYS CON=(EGA,,1)
[...]

2. Important notes

3. Error messages

4. History

0.10 beta (2003-06-29)

0.20 beta (2003-07-01)

0.30 beta (2004-08-29)

0.31 beta (2004-11-07)

0.32 beta (2004-11-28)

0.33 beta (2005-05-08)

0.35 beta (2013-03-16)

5. To do

The following changes are planned for the next release:

6. Copyright and legal issues

This software is freeware. You may use it as long as you wish and you may spread it as you like provided that it is in the original unmodified archive. Don't distribute single files, only the whole package, and don't ask for money above the normal fee of the distribution media itself. This software may not be included in any compilation, sold on disk or CD/DVD-ROM or bundled with software or hardware without prior permission from the author.

The source of this software is public domain and provided here "as is" – I don't feel like commenting it more but if you have problems then feel free to ask me. If you derive your own software from the source or put a part of the source into your own software, please, give me a credit and send a copy to me.

The author accepts no liability for any damage or data loss caused by this software.

7. The author

If you're interested in some similarly useful utilities then contact me at the E-mail address sta@c64.org or visit my homepage at http://sta.c64.org.

Joe Forster/STA
17th March, 2013

(This page best viewed with any browser)